csd214
09-27-2004, 04:15 PM
When a Verify Serial Number (or an Edit Field) screen appears, I want the first input box to have the focus. I entered the Screen.SetFocus() command as a On Preload action. It did not work. I added Screen.GetFocus(), and 821 (=CTRL_EDIT_01) was reported before the screen showed up, but always the Next button had the focus (I had to press TAB twice to enter the input box).
The help file is cryptic:
Note: This action will not function correctly if called from the On Preload event. You cannot set focus to static controls or controls that are not visible, or disabled.
At last I found a working solution:
On Preload:
Screen.StartTimer(500);
On Ctrl Message:
if MSGID_ONTIMER then
Screen.SetFocus(CTRL_EDIT_01);
end
If this is "the way to do it", it should be added to the help doc.
In any case: This solution works excellent.
The help file is cryptic:
Note: This action will not function correctly if called from the On Preload event. You cannot set focus to static controls or controls that are not visible, or disabled.
At last I found a working solution:
On Preload:
Screen.StartTimer(500);
On Ctrl Message:
if MSGID_ONTIMER then
Screen.SetFocus(CTRL_EDIT_01);
end
If this is "the way to do it", it should be added to the help doc.
In any case: This solution works excellent.