Zomp Posted August 25, 2008 Posted August 25, 2008 (edited) Forgive me if I don't know the right words. I have a GUI window and a button on it which opens another GUI window. Such window has to lay over the window it has been call and it must prevent the user to focus previous windows of the same AutoIt script. Which commands or flags have I to use to open such window? Thanks. Edited August 25, 2008 by Zomp
Andreik Posted August 25, 2008 Posted August 25, 2008 Forgive me if I don't know the right words. I have a GUI window and a button on it which opens another GUI window. Such window has to lay over the other window and it must prevent the user to focus previous windows of the same AutoIt script. How can I do it?Create a GUI with $WS_EX_TOPMOST style.
Zomp Posted August 26, 2008 Author Posted August 26, 2008 Create a GUI with $WS_EX_TOPMOST style. Well, I have tried, but I also want that the "back" window remains no selectable while the foreground window is open. Similarly to waht happens when I open a "save as" dialog: any temptative to select to the back window yields a beep.Is it possible?
Bert Posted August 26, 2008 Posted August 26, 2008 You can also change the parent using GuiSetState(@SW_HIDE) while the child is active. When the child is closed, then use GuiSetState(@SW_SHOW) to show the parent again. The Vollatran project My blog: http://www.vollysinterestingshit.com/
Moderators SmOke_N Posted August 26, 2008 Moderators Posted August 26, 2008 You can pass the main GUI's handle to the next GUI to open as it's parent GUI, and place the main GUI's handle in the parent hwnd parameter of the new GUI. Before doing this, you want to LOCK the parent with GUISetState() + @SW_LOCK and then unlock it when you are done with the child GUI with GUISetState() + @SW_UNLOCK. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Zomp Posted August 28, 2008 Author Posted August 28, 2008 You can pass the main GUI's handle to the next GUI to open as it's parent GUI, and place the main GUI's handle in the parent hwnd parameter of the new GUI. Before doing this, you want to LOCK the parent with GUISetState() + @SW_LOCK and then unlock it when you are done with the child GUI with GUISetState() + @SW_UNLOCK. Sorry, I have tried but without success. In the following toy example, I can close the application even if the background window is locked. Am I doing anything wrong? #include <GUIConstants.au3> $back=Guicreate("") $close=GUICtrlCreateButton("close",10,10) $open=GUICtrlCreateButton("open",10,50) guisetstate(@SW_SHOW) $fore=Guicreate("","","","","","",$WS_EX_TOPMOST,$back) guisetstate(@SW_HIDE) While true $msg=GUIGetMsg() Switch $msg case $close Exit case $open guisetstate(GUISetState() + @SW_LOCK,$back) guisetstate(@sw_show,$fore) EndSwitch WEnd exit
martin Posted August 28, 2008 Posted August 28, 2008 Sorry, I have tried but without success. In the following toy example, I can close the application even if the background window is locked. Am I doing anything wrong? #include <GUIConstants.au3> $back=Guicreate("") $close=GUICtrlCreateButton("close",10,10) $open=GUICtrlCreateButton("open",10,50) guisetstate(@SW_SHOW) $fore=Guicreate("","","","","","",$WS_EX_TOPMOST,$back) guisetstate(@SW_HIDE) While true $msg=GUIGetMsg() Switch $msg case $close Exit case $open guisetstate(GUISetState() + @SW_LOCK,$back) guisetstate(@sw_show,$fore) EndSwitch WEnd exitYou need case $open guisetstate(@SW_DISABLE,$back) guisetstate(@sw_show,$fore) Then when you want to get back to the 'back' gui set @SW_ENABLE. I think @SW_LOCK just stops repainting. You need some way to get back at the moment because in your example there is no way to close the script once the 'back' gui is disabled. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Zomp Posted August 28, 2008 Author Posted August 28, 2008 You need case $open guisetstate(@SW_DISABLE,$back) guisetstate(@sw_show,$fore) Then when you want to get back to the 'back' gui set @SW_ENABLE. I think @SW_LOCK just stops repainting. You need some way to get back at the moment because in your example there is no way to close the script once the 'back' gui is disabled. Perfect! Many thanks.
DYONISII Posted December 19, 2008 Posted December 19, 2008 (edited) hey guys! could you help me a bit? i need a modal fileopendialog so i have the following code: GUISetState(@SW_DISABLE, $parent) $retval = FileOpenDialog("Select File", "", "All (*.*)", 1) GUISetState(@SW_ENABLE, $parent) following is my dilemma: after closing the fileopendialog window, either by selecting a file or by cancel, the main window loses focus. my option for the moment is "WinActivate" after i enable the parent window. my other option is to use @SW_HIDE and @SW_SHOW, but the preference for the moment is not to hide the $parent window, but rather let it stand there. thanks in advance for your help! Edited December 19, 2008 by DYONISII http://dev.dyonisii.com/
DYONISII Posted December 19, 2008 Posted December 19, 2008 found it! the last parameter of fileopendialog is "hwnd." including it would make the dialog box modal. hehehe... http://dev.dyonisii.com/
babelpatcher Posted October 24, 2012 Posted October 24, 2012 found it!the last parameter of fileopendialog is "hwnd." including it would make the dialog box modal. hehehe...can you or anyone tell me how to set the hwnd correctly?i have same problem here
Moderators Melba23 Posted October 24, 2012 Moderators Posted October 24, 2012 babelpatcher, Stick with just one thread at a time please. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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