Loading...
 

Focus

Focus

Focus(windowID, childID), Focus(windowID), Focus(, childID), Focus,
Focus(NEXT), Focus(windowID, NEXT), Focus(, NEXT)

parameters: Identifier of a Windows and a child Windows object

Stack
Stack Position Description
Stack(In) Top -
Stack(Out) Top -

Focus(STACK)

Stack
Stack Position Description
Stack(In) Top CX_WIDGET | STRING
Stack(Out) Top -

Directs the input focus to the identified field. A window that is currently covered (completely or partially) by others can be brought to the foreground with Focus.

The NEXT parameter automatically focuses on the next widget in the tab order. If no windowID is specified, as with "Focus(NEXT)" or "Focus(, NEXT)", the next widget in the current window is selected.
For the tab order see also SetTabOrder.

The STACK parameter is used to focus the widget belonging to CX_WIDGET. Alternatively, the widget can be addressed by a character string on the stack, which contains the name of the widget.

Focus also triggers the CURRENT / NON_CURRENT events.

Note: If Focus is triggered during the processing of INITIALIZE of a window (i.e. within OpenWindow), the CURRENT/NON_CURRENT events are not immediately triggered on the widget. Instead, the widget is focused and as soon as the initialisation of the window is completed, the CURRENT event is triggered on the last widget in focus.

Note: If the widget to be focused is a child object of an inactive notebook strap, the notebook strap is not implicitly changed. However, the widget receives the focus as soon as the corresponding notebook strap is changed.

The focus should be directed to a certain child object - here input field s2 - as soon as the window appears on the screen:

Window(win1, 10, 10, 320, 150, T("Fenster 1", "window 1", "fenêtre 1")) [ INITIALIZE: Focus(, s2) ] { Prompt(p1, 20, 10, "s1") String(s1, 150, 10, 200) Prompt(p1, 20, 20, "s2") String(s2, 150, 20, 200) . . . }