GetFocus
PowerScript event
Description
Occurs just before the control receives focus (before it is selected
and becomes active).
GetFocus applies to all controls
Event ID
|
Event ID |
Objects |
|---|---|
|
pbm_bnsetfocus |
CheckBox, CommandButton, Graph, OLE, Picture, |
|
pbm_cbnsetfocus |
DropDownListBox, |
|
pbm_dwnsetfocus |
DataWindow |
|
pbm_ensetfocus |
SingleLineEdit, EditMask, MultiLineEdit, StaticText, |
|
pbm_lbnsetfocus |
ListBox, PictureListBox |
|
pbm_lvnsetfocus |
ListView |
|
pbm_rensetfocus |
RichTextEdit |
|
pbm_sbnsetfocus |
HScrollBar, HTrackBar, VScrollBar, |
|
pbm_setfocus |
HProgressBar, VProgressBar, DatePicker, |
|
pbm_tcnsetfocus |
Tab |
|
pbm_tvnsetfocus |
TreeView |
Arguments
None
Return Values
Long.
Return code choices (specified in a RETURN statement):
0 — Continue processing
Examples
Example 1
This example in a SingleLineEdit control’s GetFocus event selects
the text in the control when the user tabs to it:
|
1 |
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:
|
1 |
This. EVENT POST ue_select( ) |
This code is in the ue_select user event:
|
1 |
This.SelectText(1, Len(This.Text)) |
See also