IndyUK Posted October 14, 2009 Share Posted October 14, 2009 Hi All, I've got a main form for my script which works fine. However, I want to open another form from it and have that form be modal. I'm mean modal in the sense that the focus cannot move from it. I looked at the various styles for GUICreate and none seem to do what I need. The closest was the $WS_EX_TOPMOST style but that still allows you to move the focus to other forms although leaves the form on-top. Any ideas which style I need to use? Thanks Link to comment Share on other sites More sharing options...
dantay9 Posted October 14, 2009 Share Posted October 14, 2009 You need to make the second window a child window and disable the parent window. There are plenty of examples for child windows all over the forum. Link to comment Share on other sites More sharing options...
IndyUK Posted October 15, 2009 Author Share Posted October 15, 2009 I've setup the window as a child window but I can still operate the parent window even though the child window is on top. This is the line I'm using to create the child window. What am I still doing wrong? $frmAddNewScript = GUICreate("Add New Script", 427, 437, 220, 133, $DS_SETFOREGROUND, "", $Form1) Link to comment Share on other sites More sharing options...
jvanegmond Posted October 15, 2009 Share Posted October 15, 2009 What you are doing wrong is not providing a reproduction script. You should be punished for your insolence!! Joking aside, here's what you wanted.. Can has treat please. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> $main = GUICreate("MyGUI", 392, 322) $Button_1 = GUICtrlCreateButton("Input", 140, 190, 70, 30) GUISetState() $popup = GUICreate("PopUP", 191, 185, -1, -1, -1, $WS_EX_TOPMOST) While 1 $msg = GUIGetMsg(1) Select Case $msg[1] = $popup And $msg[0] = $GUI_EVENT_CLOSE ; Modal close GUISetState(@SW_HIDE, $popup) GUISetState(@SW_ENABLE, $main) WinActivate($main) Case $msg[1] = $main And $msg[0] = $GUI_EVENT_CLOSE ; Main close ExitLoop Case $msg[1] = $main And $msg[0] = $Button_1 ; Input click, modal open GUISetState(@SW_DISABLE, $main) GUISetState(@SW_SHOW, $popup) EndSelect WEnd Exit github.com/jvanegmond Link to comment Share on other sites More sharing options...
IndyUK Posted October 15, 2009 Author Share Posted October 15, 2009 What you are doing wrong is not providing a reproduction script. You should be punished for your insolence!!Joking aside, here's what you wanted.. Can has treat please.Thank you very much. This has worked perfectly. 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