comradeb14ck Posted April 28, 2007 Share Posted April 28, 2007 Hey guys. I am doing something along these lines: I have an application with a main GUI window. When I press a button, another GUI window is created. What I want to do is make it so that when the new window is opened, it is impossible to get back to the main window without first closing this window. How can I do this? Thanks for your time and help. -b14ck Link to comment Share on other sites More sharing options...
Generator Posted April 28, 2007 Share Posted April 28, 2007 Hey guys. I am doing something along these lines:I have an application with a main GUI window. When I press a button, another GUI window is created.What I want to do is make it so that when the new window is opened, it is impossible to get back to the main window without first closing this window. How can I do this? Thanks for your time and help.-b14ckMind posting your code?You may try WinSetState("","",@SW_DISABLE)Not sure if it's gonna work. Link to comment Share on other sites More sharing options...
comradeb14ck Posted April 28, 2007 Author Share Posted April 28, 2007 (edited) Sure, here is the code as it is now, although, I'm sure that it won't exactly work for you since you don't have the same pic files as I do. expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.2.0 Author: comradeb14ck (www.projectb14ck.org) Script Function: Update a user on woot.com's current item. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GuiConstants.au3> $COLOR = "red"; color of main window $WINDOW_HEIGHT = 70; height of main window $WINDOW_WIDTH = 400; width of main window $PREFERENCES_HEIGHT = 20; width of preferences menu (added onto the GUI) ; GUI GuiCreate("projectb14ck - woot checker", $WINDOW_WIDTH, $WINDOW_HEIGHT) GuiSetIcon("PB.ico", 0) ; menu $prefmenu = GuiCtrlCreateMenu("&Preferences") $colormenu = GUICtrlCreateMenu("Color", $prefmenu, 1) $optred = GUICtrlCreateMenuItem("Red", $colormenu) $optblue = GUICtrlCreateMenuItem("Blue", $colormenu) $optblack = GUICtrlCreateMenuItem("Black", $colormenu) $optwhite = GUICtrlCreateMenuItem("White", $colormenu) $optgreen = GUICtrlCreateMenuItem("Green", $colormenu) $optorange = GUICtrlCreateMenuItem("Orange", $colormenu) $optyellow = GUICtrlCreatemenuItem("Yellow", $colormenu) $sizemenu = GUICtrlCreateMenu("Size", $prefmenu, 3) $optcsize = GUICtrlCreateMenuItem("Edit Size", $sizemenu) $behaviormenu = GUICtrlCreateMenu("Behavior", $prefmenu, 4) $optnormal = GUICtrlCreateMenuItem("Normal", $behaviormenu) $optontop = GUICtrlCreatemenuItem("Always on Top", $behaviormenu) $refreshmenu = GUICtrlCreateMenu("Refresh Rate", $prefmenu, 5) $optcrefresh = GUICtrlCreateMenuItem("Edit Refresh Rate", $refreshmenu) ; new woot info GuiCtrlCreatePic("PB.ico", 5, 5, $WINDOW_HEIGHT - 10, $WINDOW_HEIGHT - $PREFERENCES_HEIGHT - 10) GuiCtrlCreateLabel("some woot item here $55.99 + $5 shipping and yaya some otheruff", $WINDOW_HEIGHT, 10, $WINDOW_WIDTH - $WINDOW_HEIGHT - 20, 25) ; GUI MESSAGE LOOP GuiSetState() While 1 $msg = GUIGetMsg() ; change background color? If $msg = $optred Then GUISetBkColor(0xff0000) ElseIf $msg = $optblue Then GUISetBkColor(0x0000ff) ElseIf $msg = $optblack Then GUISetBkColor(0x000000) ElseIf $msg = $optwhite Then GUISetBkColor(0xffffff) ElseIf $msg = $optgreen Then GUISetBkColor(0x008000) ElseIf $msg = $optorange Then GUISetBkColor(0xffa500) ElseIf $msg = $optyellow Then GUISetBkColor(0xffff00) EndIf ; change the size? If $msg = $optcsize Then GUICreate("projectb14ck - edit size", 100, 100) GuiSetIcon("PB.ico", 0) GUISetState() While 1 $msg2 = GUIGetMsg() If $msg2 = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() EndIf ; change font color? If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd I should probably add that the window I want to "force on top of the other one" so that the user cannot get back to the first window without first closing the new window is the window I create when the user clicks on the "Edit Size" button. Edited April 28, 2007 by comradeb14ck Link to comment Share on other sites More sharing options...
comradeb14ck Posted April 29, 2007 Author Share Posted April 29, 2007 bump Link to comment Share on other sites More sharing options...
Zedna Posted April 29, 2007 Share Posted April 29, 2007 Make your second GUI as child window of first GUI. Look into helpfile at GUICreate() parametres. I'm using it in some of my projects. But this way is not fully disabled accessibilty of first GUI, maybe @SW_DISABLED as someone posted above ... Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
Generator Posted April 29, 2007 Share Posted April 29, 2007 Sure, here is the code as it is now, although, I'm sure that it won't exactly work for you since you don't have the same pic files as I do. expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.2.0 Author: comradeb14ck (www.projectb14ck.org) Script Function: Update a user on woot.com's current item. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GuiConstants.au3> $COLOR = "red"; color of main window $WINDOW_HEIGHT = 70; height of main window $WINDOW_WIDTH = 400; width of main window $PREFERENCES_HEIGHT = 20; width of preferences menu (added onto the GUI) ; GUI GuiCreate("projectb14ck - woot checker", $WINDOW_WIDTH, $WINDOW_HEIGHT) GuiSetIcon("PB.ico", 0) ; menu $prefmenu = GuiCtrlCreateMenu("&Preferences") $colormenu = GUICtrlCreateMenu("Color", $prefmenu, 1) $optred = GUICtrlCreateMenuItem("Red", $colormenu) $optblue = GUICtrlCreateMenuItem("Blue", $colormenu) $optblack = GUICtrlCreateMenuItem("Black", $colormenu) $optwhite = GUICtrlCreateMenuItem("White", $colormenu) $optgreen = GUICtrlCreateMenuItem("Green", $colormenu) $optorange = GUICtrlCreateMenuItem("Orange", $colormenu) $optyellow = GUICtrlCreatemenuItem("Yellow", $colormenu) $sizemenu = GUICtrlCreateMenu("Size", $prefmenu, 3) $optcsize = GUICtrlCreateMenuItem("Edit Size", $sizemenu) $behaviormenu = GUICtrlCreateMenu("Behavior", $prefmenu, 4) $optnormal = GUICtrlCreateMenuItem("Normal", $behaviormenu) $optontop = GUICtrlCreatemenuItem("Always on Top", $behaviormenu) $refreshmenu = GUICtrlCreateMenu("Refresh Rate", $prefmenu, 5) $optcrefresh = GUICtrlCreateMenuItem("Edit Refresh Rate", $refreshmenu) ; new woot info GuiCtrlCreatePic("PB.ico", 5, 5, $WINDOW_HEIGHT - 10, $WINDOW_HEIGHT - $PREFERENCES_HEIGHT - 10) GuiCtrlCreateLabel("some woot item here $55.99 + $5 shipping and yaya some otheruff", $WINDOW_HEIGHT, 10, $WINDOW_WIDTH - $WINDOW_HEIGHT - 20, 25) ; GUI MESSAGE LOOP GuiSetState() While 1 $msg = GUIGetMsg() ; change background color? If $msg = $optred Then GUISetBkColor(0xff0000) ElseIf $msg = $optblue Then GUISetBkColor(0x0000ff) ElseIf $msg = $optblack Then GUISetBkColor(0x000000) ElseIf $msg = $optwhite Then GUISetBkColor(0xffffff) ElseIf $msg = $optgreen Then GUISetBkColor(0x008000) ElseIf $msg = $optorange Then GUISetBkColor(0xffa500) ElseIf $msg = $optyellow Then GUISetBkColor(0xffff00) EndIf ; change the size? If $msg = $optcsize Then GUICreate("projectb14ck - edit size", 100, 100) GuiSetIcon("PB.ico", 0) GUISetState() While 1 $msg2 = GUIGetMsg() If $msg2 = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() EndIf ; change font color? If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd I should probably add that the window I want to "force on top of the other one" so that the user cannot get back to the first window without first closing the new window is the window I create when the user clicks on the "Edit Size" button.I suggest you use OnEvent mode as this gets way easier and I am able to help. I am not good with Msgloop mode. Link to comment Share on other sites More sharing options...
xcal Posted April 29, 2007 Share Posted April 29, 2007 CODEexpandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.2.0 Author: comradeb14ck (www.projectb14ck.org) Script Function: Update a user on woot.com's current item. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GuiConstants.au3> $COLOR = "red"; color of main window $WINDOW_HEIGHT = 70; height of main window $WINDOW_WIDTH = 400; width of main window $PREFERENCES_HEIGHT = 20; width of preferences menu (added onto the GUI) ; GUI $gui1 = GuiCreate("projectb14ck - woot checker", $WINDOW_WIDTH, $WINDOW_HEIGHT) GuiSetIcon("PB.ico", 0) ; menu $prefmenu = GuiCtrlCreateMenu("&Preferences") $colormenu = GUICtrlCreateMenu("Color", $prefmenu, 1) $optred = GUICtrlCreateMenuItem("Red", $colormenu) $optblue = GUICtrlCreateMenuItem("Blue", $colormenu) $optblack = GUICtrlCreateMenuItem("Black", $colormenu) $optwhite = GUICtrlCreateMenuItem("White", $colormenu) $optgreen = GUICtrlCreateMenuItem("Green", $colormenu) $optorange = GUICtrlCreateMenuItem("Orange", $colormenu) $optyellow = GUICtrlCreatemenuItem("Yellow", $colormenu) $sizemenu = GUICtrlCreateMenu("Size", $prefmenu, 3) $optcsize = GUICtrlCreateMenuItem("Edit Size", $sizemenu) $behaviormenu = GUICtrlCreateMenu("Behavior", $prefmenu, 4) $optnormal = GUICtrlCreateMenuItem("Normal", $behaviormenu) $optontop = GUICtrlCreatemenuItem("Always on Top", $behaviormenu) $refreshmenu = GUICtrlCreateMenu("Refresh Rate", $prefmenu, 5) $optcrefresh = GUICtrlCreateMenuItem("Edit Refresh Rate", $refreshmenu) ; new woot info GuiCtrlCreatePic("PB.ico", 5, 5, $WINDOW_HEIGHT - 10, $WINDOW_HEIGHT - $PREFERENCES_HEIGHT - 10) GuiCtrlCreateLabel("some woot item here $55.99 + $5 shipping and yaya some otheruff", $WINDOW_HEIGHT, 10, $WINDOW_WIDTH - $WINDOW_HEIGHT - 20, 25) ; GUI MESSAGE LOOP GuiSetState() While 1 $msg = GUIGetMsg() ; change background color? If $msg = $optred Then GUISetBkColor(0xff0000) ElseIf $msg = $optblue Then GUISetBkColor(0x0000ff) ElseIf $msg = $optblack Then GUISetBkColor(0x000000) ElseIf $msg = $optwhite Then GUISetBkColor(0xffffff) ElseIf $msg = $optgreen Then GUISetBkColor(0x008000) ElseIf $msg = $optorange Then GUISetBkColor(0xffa500) ElseIf $msg = $optyellow Then GUISetBkColor(0xffff00) EndIf ; change the size? If $msg = $optcsize Then $gui2 = GUICreate("projectb14ck - edit size", 100, 100) GuiSetIcon("PB.ico", 0) GUISetState(@SW_DISABLE, $gui1) GUISetState(@SW_SHOW, $gui2) While 1 $msg2 = GUIGetMsg() If $msg2 = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUISetState(@SW_ENABLE, $gui1) GUIDelete($gui2) EndIf ; change font color? If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
xcal Posted April 29, 2007 Share Posted April 29, 2007 Ok, I was bored and changed the while loop and how the colors menu is created/functions. CODEexpandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.2.0 Author: comradeb14ck (www.projectb14ck.org) Script Function: Update a user on woot.com's current item. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GuiConstants.au3> $COLOR = "red"; color of main window $WINDOW_HEIGHT = 70; height of main window $WINDOW_WIDTH = 400; width of main window $PREFERENCES_HEIGHT = 20; width of preferences menu (added onto the GUI) ; GUI $gui1 = GUICreate("projectb14ck - woot checker", $WINDOW_WIDTH, $WINDOW_HEIGHT) GUISetIcon("PB.ico", 0) ; menu $prefmenu = GUICtrlCreateMenu("&Preferences") $colormenu = GUICtrlCreateMenu("Color", $prefmenu, 1) Dim $menu_items[8], $colors[8] = [7, 'Red', 'Blue', 'Black', 'White', 'Green', 'Orange', 'Yellow'], _ $red = 0xff0000, $blue = 0x0000ff, $black = 0x000000, $white = 0xffffff, $green = 0x008000, $orange = 0xffa500, $yellow = 0xffff00 For $i = 1 To 7 $menu_items[$i] = GUICtrlCreateMenuItem($colors[$i], $colormenu) Next $sizemenu = GUICtrlCreateMenu("Size", $prefmenu, 3) $optcsize = GUICtrlCreateMenuItem("Edit Size", $sizemenu) $behaviormenu = GUICtrlCreateMenu("Behavior", $prefmenu, 4) $optnormal = GUICtrlCreateMenuItem("Normal", $behaviormenu) $optontop = GUICtrlCreateMenuItem("Always on Top", $behaviormenu) $refreshmenu = GUICtrlCreateMenu("Refresh Rate", $prefmenu, 5) $optcrefresh = GUICtrlCreateMenuItem("Edit Refresh Rate", $refreshmenu) GUICtrlCreatePic("PB.ico", 5, 5, $WINDOW_HEIGHT - 10, $WINDOW_HEIGHT - $PREFERENCES_HEIGHT - 10) GUICtrlCreateLabel("some woot item here $55.99 + $5 shipping and yaya some otheruff", $WINDOW_HEIGHT, 10, $WINDOW_WIDTH - $WINDOW_HEIGHT - 20, 25) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $menu_items[1] To $menu_items[7] GUISetBkColor(Eval(GUICtrlRead($msg, 1))) Case $optcsize $gui2 = GUICreate("projectb14ck - edit size", 100, 100) GUISetIcon("PB.ico", 0) GUISetState(@SW_DISABLE, $gui1) GUISetState(@SW_SHOW, $gui2) While 1 $msg2 = GUIGetMsg() If $msg2 = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUISetState(@SW_ENABLE, $gui1) GUIDelete($gui2) Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
comradeb14ck Posted April 29, 2007 Author Share Posted April 29, 2007 Thanks a lot for your help. I appreciate it a lot. =) 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