AutoHotkey Community

It is currently May 27th, 2012, 12:40 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: September 21st, 2005, 2:14 am 
Offline

Joined: September 19th, 2005, 10:20 pm
Posts: 3
Since this is my first post, I would like to say a huge thanks to Chris for his work on this project. I am a newby, but I am so hooked on Autohotkey that is all I want to do lately. Keep up the great work!

Since I am a new, forgive me if the functionality I am requesting exists already...

1. The WinWait and related commands are great, but I would love some more granularity. What about a ControlWaitGetFocus, which will wait until a specific control has focus without resorting to Loops and sleeps etc.. Along the same lines would be ControlWaitLoseFocus and ControlWaitHover. Optionally, this could just be ControlWait, with commands like GetFocus, LoseFocus, Hover etc.

2. Even better would be hotkeys that could be triggered by control focus events, thus allowing multiple threads to be spawned on a form that is polulated with controls...perhaps something like a C-Label. This would be great for data verification and other tasks in applications that do not support data verification. For example, when ClaEdit13 loses focus on the window title MyForm:

::CClaEdit13, LoseFocus, MyForm
if (ClaEdit13 = "Chris")
MsgBox, Chris is da man!
else
MsgBox, Why not Chris?

The above seems very difficult to do currently if you are working with dozens or even hundreds of fields on "MyForm"

3. Perhaps there is some way to do this, but if so I don't know how. I would like to be able to "trap" a click on a control so that I can do a bunch of processing on a form before it is closed, and then after I am done, send that click to the "save and close" button to close the form. I know how to click the control, but is there some way to trap the event and prevent it from happening?

Thanks again!

Regards,

Kevin


Report this post
Top
 Profile  
Reply with quote  
PostPosted: September 21st, 2005, 8:58 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group