Top Qat Posted March 3, 2006 Share Posted March 3, 2006 I have an AutoIT3 script that works fine except for one minor problem. Whenever I show a MSGbox or get a file or folder the main GUI controls can still be used. I need to be able to stop the main GUI from being focus whenever I have MSG box / FileSelectFolder / FileOpenDialog active. Any idea? Link to comment Share on other sites More sharing options...
Developers Jos Posted March 3, 2006 Developers Share Posted March 3, 2006 I have an AutoIT3 script that works fine except for one minor problem.Whenever I show a MSGbox or get a file or folder the main GUI controls can still be used.I need to be able to stop the main GUI from being focus whenever I have MSG box / FileSelectFolder / FileOpenDialog active.Any idea?GUISetState(@SW_Disable) or GUISetState(@SW_Hide) ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Top Qat Posted March 3, 2006 Author Share Posted March 3, 2006 (edited) Ahha! Told ya i was a noob didn't I ! Thanks that seems to work except for one problem GUISetState (@SW_Disable , $Form[1] ) $result = FileSelectFolder ( 'Select the remote Windows directory...', $MyComputer , 0 ) $error = @error GUISetState (@SW_Enable , $Form[1] ) This makes the GUI jump behind the last active window and lose focus. So I need to make sure it has focus. What now? ...more... How do I set the OK button to be default and respond to the Enter key? Edited March 3, 2006 by Top Qat Link to comment Share on other sites More sharing options...
Developers Jos Posted March 3, 2006 Developers Share Posted March 3, 2006 This makes the GUI jump behind the last active window and lose focus.So I need to make sure it has focus.What now?WInActivate() ?How do I set the OK button to be default and respond to the Enter key?Set Button style to $BS_DEFPUSHBUTTON ... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Sokko Posted March 3, 2006 Share Posted March 3, 2006 (edited) This makes the GUI jump behind the last active window and lose focus.So I need to make sure it has focus.Set the window to @SW_SHOW after the @SW_ENABLE.EDIT: JdeB got in while I was posting (fast!). Edited March 3, 2006 by Sokko Link to comment Share on other sites More sharing options...
Top Qat Posted March 3, 2006 Author Share Posted March 3, 2006 GUISetState (@SW_Disable , $Form[1] ) $result = FileSelectFolder ( 'Select the remote Windows directory...', $MyComputer , 0 ) $error = @error GUISetState (@SW_Enable , $Form[1] ) GUISetState (@SW_Show , $Form[1] ) @Sokko Still the same focus problem with this code. @JdeB The WinActivate( ) method seems a little untidy, I would prefer to use the saved Form GUI ID if possible. Link to comment Share on other sites More sharing options...
Valuater Posted March 3, 2006 Share Posted March 3, 2006 maybe GUISetState (@SW_Hide , $Form[1] ) $result = FileSelectFolder ( 'Select....... blah Link to comment Share on other sites More sharing options...
Top Qat Posted March 3, 2006 Author Share Posted March 3, 2006 GUISetState (@SW_Hide , $Form[1]) Ok, that works better. Only thing I don't like is that it leaves the File/Folder dialog without any reference to which program it belongs to. I'm a bit of a perfectionist I am Link to comment Share on other sites More sharing options...
Valuater Posted March 3, 2006 Share Posted March 3, 2006 FileSelectFolder Dialoge has a title and text lines.. use that to keep your Program title/info 8) Link to comment Share on other sites More sharing options...
Top Qat Posted March 3, 2006 Author Share Posted March 3, 2006 FileSelectFolder Dialoge has a title and text lines.. use that to keep your Program title/infoYup, thought about that. Works for FileOpenDialog.FileSelectFolder does not allow the window title to be specified. Link to comment Share on other sites More sharing options...
Top Qat Posted March 3, 2006 Author Share Posted March 3, 2006 Whenever I get an AutoIT error box, it behaves exactly the way I need. Link to comment Share on other sites More sharing options...
Valuater Posted March 3, 2006 Share Posted March 3, 2006 maybe you could use an inputbox that would act the same and put this as the "default" $MyComputer 8) Link to comment Share on other sites More sharing options...
Top Qat Posted March 4, 2006 Author Share Posted March 4, 2006 MsgBox ( 16 + 8192 + 262144 , $Title , 'Blah blah blah!' ) Those numbers fix the MsgBox focus problem. They are: Stop-sign icon Task modal MsgBox has top-most attribute set Link to comment Share on other sites More sharing options...
Sokko Posted March 4, 2006 Share Posted March 4, 2006 GUISetState (@SW_Disable , $Form[1] ) $result = FileSelectFolder ( 'Select the remote Windows directory...', $MyComputer , 0 ) $error = @error GUISetState (@SW_Enable , $Form[1] ) GUISetState (@SW_Show , $Form[1] ) @Sokko Still the same focus problem with this code. Whoops, nevermind. I had this same problem before, but with a child window instead of a folder selection, and I thought I fixed it by doing that. Looking at the code, I actually did it another way, which wouldn't be possible to use with a folder selection (since I'm fairly certain it relies on the properties of child windows). Link to comment Share on other sites More sharing options...
Developers Jos Posted March 4, 2006 Developers Share Posted March 4, 2006 (edited) Don't know if I mentioned it before but what about WinActivate? Something like: Opt("WinTitleMatchMode", 4) $H_Active_Win = WinGetHandle() ; your msgbox WinActivate($H_Active_Win) Edited March 4, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Top Qat Posted March 4, 2006 Author Share Posted March 4, 2006 Thanks guys, i'll give it a go. Link to comment Share on other sites More sharing options...
Top Qat Posted March 8, 2006 Author Share Posted March 8, 2006 (edited) So to sum up. I can't set File/Folder dailogs to act as 'task modal' like the message box. The only way to stop any extra GUI form events is to disable all the controls before the call, then re-enable them all after. ...or do this after each Folder/File dialog ;Get rid of any excess events Func ClearGuiEvents ( ) While GuiGetMsg() ; Do nothing Wend EndFunc Perhaps this is something to look at as a new feature that can be added (i.e Task modal for browse dialogs) Edited March 8, 2006 by Top Qat Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now