Sign in to follow this  
Followers 0
CyberSlug

Autogui Focus

3 posts in this topic

When an AutoGUI window is minimized then restored, is it possible to automatically return focus to the last active control?

The workaround is only two lines, but I think this should be the default behaviour.

Global $title = "text editor foo", $focus

Opt("GuiNotifyMode",1)
GUICreate($title, 440, 280, 100, 100)
WinActivate($title)

Global $txt1 = GUISetControl("edit", "AutoGUI is cool", 0, 30 ,430 ,220)
GUISetControlEx ($txt1, 256,   0)
GUIShow()

while 1;loop until user clicks the close button
   sleep(100)
   $message = GuiMsg(0)
   If $message = -3 Then Exit
   ; WORKAROUND ---->
   If $message = -4 Then $focus = ControlGetFocus ($title);save
   If $message = -5 Then ControlFocus ( $title, "", "Edit1");restore
Wend
Exit

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites



I think that's something the user should handle on their own, and since it is only a 2 line (Actually that would be 3 counting the declaration of the global variable...), it shouldn't be any big deal.

Share this post


Link to post
Share on other sites

When an AutoGUI window is minimized then restored, is it possible to automatically return focus to the last active control?

The workaround is only two lines, but I think this should be the default behaviour.

Global $title = "text editor foo", $focus

Opt("GuiNotifyMode",1)
GUICreate($title, 440, 280, 100, 100)
WinActivate($title)

Global $txt1 = GUISetControl("edit", "AutoGUI is cool", 0, 30 ,430 ,220)
GUISetControlEx ($txt1, 256,   0)
GUIShow()

while 1;loop until user clicks the close button
   sleep(100)
   $message = GuiMsg(0)
   If $message = -3 Then Exit
  ; WORKAROUND ---->
   If $message = -4 Then $focus = ControlGetFocus ($title);save
   If $message = -5 Then ControlFocus ( $title, "", "Edit1");restore
Wend
Exit
I try to correct this situation related with the {TAB}.

Can you give me an example so I can see what happens?

Your example does show the problem with 102.12 the caret still blinking

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0