Occurs just before the control receives focus (before it is selected and becomes active).
GetFocus applies to all controls
Event ID |
Objects |
---|---|
pbm_bnsetfocus |
CheckBox, CommandButton, Graph, Picture, PictureHyperLink, PictureButton, RadioButton |
pbm_cbnsetfocus |
DropDownListBox |
pbm_dwnsetfocus |
DataWindow |
pbm_ensetfocus |
SingleLineEdit, EditMask, MultiLineEdit, StaticText, StaticHyperLink |
pbm_lbnsetfocus |
ListBox |
pbm_lvnsetfocus |
ListView |
pbm_prnsetfocus |
HProgressBar, VProgressBar |
pbm_sbnsetfocus |
HScrollBar, HTrackBar, VScrollBar, VTrackBar |
pbm_tcnsetfocus |
Tab |
pbm_tvnsetfocus |
TreeView |
None
Long. Return code choices (specified in a RETURN statement):
0 Continue processing
Example 1 This example in a SingleLineEdit control’s GetFocus event selects the text in the control when the user tabs to it:
This.SelectText(1, Len(This.Text))
Example 2 In Example 1, when the user clicks the SingleLineEdit rather than tabbing to it, the control gets focus and the text is highlighted, but then the click deselects the text. If you define a user event that selects the text and then post that event in the GetFocus event, the highlighting works when the user both tabs and clicks. This code is in the GetFocus event:
This. EVENT POST ue_select( )
This code is in the ue_select user event:
This.SelectText(1, Len(This.Text))