exodius Posted January 5, 2006 Posted January 5, 2006 I'm not sure if this has been answered before, I couldn't find a post that addressed it directly.. Is it possible to have a gui window, and when you press a button it brings up another gui window where you can something, then when you close that window you're back to the original gui and can press the same button again to repeat the process. I can't get it to let me press the same button again to repeat the process. Any ideas? #include <GUIConstants.au3> $MainView = GUICreate("Program Evaluator", 393, 114 ) $AddProgram = GUICtrlCreateButton("Add Program", 24, 24, 161, 65) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $ViewEvaluations = GUICtrlCreateButton("View Evaluations", 208, 24, 161, 65) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW, $MainView) While 1 $msg = GuiGetMsg() Select Case $msg = $AddProgram AddProgram() Case $msg = $ViewEvaluations Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Func AddProgram() $AddProgram = GUICreate("Add Program Evaluation", 340, 417, 234, 151) GUICtrlCreateLabel("Program Name:", 24, 24, 114, 32) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $ProgramName = GUICtrlCreateInput("", 144, 24, 169, 28, -1, $WS_EX_CLIENTEDGE) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlCreateLabel("Program Version:", 24, 64, 126, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $ProgramVersion = GUICtrlCreateInput("", 160, 64, 73, 28, -1, $WS_EX_CLIENTEDGE) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlCreateLabel("Program Rating:", 24, 104, 119, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $Rating = GUICtrlCreateCombo("", 144, 104, 41, 28) GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10") GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlCreateLabel("Other Notes:", 24, 144, 94, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $OtherNotes = GUICtrlCreateEdit("", 24, 168, 289, 169, -1, $WS_EX_CLIENTEDGE) GUICtrlSetData($OtherNotes, "") $Submit = GUICtrlCreateButton("Submit", 24, 360, 107, 41) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $Clear = GUICtrlCreateButton("Clear", 208, 360, 107, 41) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE GUIDelete ( $AddProgram ) ExitLoop EndSelect WEnd EndFunc
Gigglestick Posted January 5, 2006 Posted January 5, 2006 (edited) Just create two gui's, hiding the second one until the event occurs that should activate it. Then hide the first and show the second one. Just hide the second one and show the first one when needed. Also, you are using conflicting variable names for the second gui that exist for the first gui. I.e. $AddProgram is a control on $MainView, but is the gui in the AddProgram function. Change that in the AddProgram function to $AddProgramView or something... Add this to the beginning of AddProgram(): GUISetState(@SW_HIDE, $MainView) Add this to the end of AddProgram(): GUISetState(@SW_HIDE, $AddProgramView) GUISetState(@SW_SHOW, $MainView) Edited January 5, 2006 by c0deWorm My UDFs: ExitCodes
exodius Posted January 5, 2006 Author Posted January 5, 2006 Just create two gui's, hiding the second one until the event occurs that should activate it. Then hide the first and show the second one. Just hide the second one and show the first one when needed. Also, you are using conflicting variable names for the second gui that exist for the first gui. I.e. $AddProgram is a control on $MainView, but is the gui in the AddProgram function. Change that in the AddProgram function to $AddProgramView or something... Add this to the beginning of AddProgram(): GUISetState(@SW_HIDE, $MainView) Add this to the end of AddProgram(): GUISetState(@SW_HIDE, $AddProgramView) GUISetState(@SW_SHOW, $MainView) Thanks for the advice. Changing the conflicting variable got it working. Good catch. Thanks!
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