kbross wrote:
What about a ControlWaitGetFocus, which will wait until a specific control has focus without resorting to Loops and sleeps etc..
I can see that it would be useful, but cost vs. benefit isn't that favorable due to:
1) Rarity of use.
2) As you said, you can already do it with Loop+Sleep.
However, it might become a standard library function someday, which could be put into a script via #Include.
Quote:
...control focus events, thus allowing multiple threads to be spawned on a form that is polulated with controls...
If the form you have in mind is one of the script's own GUI windows, you probably know that you can use a g-label for most validation purposes. The problem with having a generic focus-change g-label is that each control type tends to have its own way of notifying that it has lost focus, which I suspect would make implementation complex.
Has anyone else felt a need for a focus-change label that would run every time the user focuses a new control?
Quote:
3. I know how to click the control, but is there some way to trap the event and prevent it from happening?
If a form has an OK button, the ButtonOK subroutine can do conditional things. For example:
Code:
ButtonOK:
Gui, Submit, NoHide ; i.e. don't hide the window yet.
if StrLen(Password) < 4
{
Gui +OwnDialogs ; Make the following MsgBox "modal".
MsgBox The password must be at least 4 characters long.
return
}
; Otherwise, validation is complete so hide the forum and process the input:
Gui, Hide
; ... etc.
return
Welcome to the forum and thanks for the suggestions.