RequestFocus
The RequestFocus method requests that the ownership of the specified focus be assigned to the specified frame.
ODBoolean RequestFocus (in ODTypeToken focus, in ODFrame requestingFrame);
focus- A tokenized string representing the focus type whose ownership is being requested, expressed as a 32-bit value.
requestingFrame- A reference to a frame requesting the focus.
- return value
kODTrueif the frame obtained the focus, otherwisekODFalse.DISCUSSION
Thefocusparameter must be the tokenized form of one of the focus constants (kODClipboardFocus,kODKeyFocus,kODMenuFocus,kODModalFocus,kODMouseFocus,kODScrollingFocus, orkODSelectionFocus) or the tokenized form of a part-specific focus type. You can call the session object'sTokenizemethod to obtain a token corresponding to one of these constants.Your part calls this method to request a single focus for one of its frames; to request multiple foci, your part calls the arbitrator's
RequestFocusSetmethod. The return value indicates whether the specified frame obtained ownership of the specified focus.If the specified focus is nonexclusive, the specified frame is automatically granted ownership of the focus. If it is exclusive, the focus module calls the
BeginRelinquishFocusmethod of the current owner's part to see if the current owner is willing to give it up.If the request is granted, the new ownership relationship is stored in the relevant focus modules. If the request fails, the existing ownership relationships remain intact.
If the request is granted, the arbitrator contains a reference to the frame. Parts should relinquish the focus in the
DisplayFrameClosedorDisplayFrameRemovedmethods.EXCEPTIONS
kODErrFocusNotRegistered- The specified focus is not registered.
SEE ALSO
TheODFocusTypetype (page 889).
TheODTypeTokentype (page 877).
TheODArbitrator::RequestFocusSetmethod (page 55).
TheODPart::BeginRelinquishFocusmethod (page 482).
TheODSession::Tokenizemethod (page 622).
Listing 2-31 on page 88 in OpenDoc Cookbook.
"Requesting Foci" on page 208 in OpenDoc Programmer's Guide.
"Handling a Simple Modal Dialog Box" on page 233 in OpenDoc Programmer's Guide.
"Acquiring and Relinquishing the Clipboard Focus" on page 356 in OpenDoc Programmer's Guide.