erezlevi Posted January 11, 2008 Share Posted January 11, 2008 hi, how can i close a SUB GUI to retrun back to the first GUI? GUICreate("IP phone selection",250,200,0,0) GUISetIcon ("c:\ring.ico") Opt("GUICoordMode",1) GUICtrlCreateLabel ("Please enter extension number:",10,10) $station=guictrlcreateinput ("",10,30) GUICtrlCreateLabel ("Select your extension type:",10,60) $button1=guictrlcreatebutton ("4610",30,80,100,20) $button2=guictrlcreatebutton ("4620",30,110,100,20) $button3=GUICtrlCreateButton ("9620",30,140,100,20) $button4=GUICtrlCreateButton ("9630",30,170,100,20) GUISetState () while 1 $msg = GUIGetMsg() Select case $msg=$button1 $firstinput=GUICtrlRead ($station) Guicreate ("4610 phone",180,150,100,100) GUISetIcon ("c:\ring.ico") Opt ("GUICoordMode",1) GUICtrlCreateLabel ("please select where to change:",10,10) $button5=guictrlcreatebutton ("Phone-Main",30,60,100,20) $button6=guictrlcreatebutton ("SpDial",30,90,100,20) guisetstate () case $msg = $GUI_Event_Close [don't know what to put here to retrun to first gui window] Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 11, 2008 Share Posted January 11, 2008 You need to save the hanles to the GUIs you create. I prefer GuiOnEventMode, but this would work for GuiGetMsg() loops: #include <GuiConstants.au3> $hParent = GUICreate("IP phone selection", 250, 200, 0, 0) $button1 = GUICtrlCreateButton("4610", 30, 80, 100, 20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_Event_Close Exit Case $msg = $button1 $hChild = GUICreate("4610 phone", 180, 150, 100, 100) GUISetState() While 1 $msg = GUIGetMsg(1) If $msg[0] <> 0 And $msg[1] = $hChild Then Select Case $msg[0] = $GUI_Event_Close GUIDelete($hChild) ExitLoop EndSelect EndIf WEnd EndSelect WEnd Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
erezlevi Posted January 12, 2008 Author Share Posted January 12, 2008 You need to save the hanles to the GUIs you create. I prefer GuiOnEventMode, but this would work for GuiGetMsg() loops: #include <GuiConstants.au3> $hParent = GUICreate("IP phone selection", 250, 200, 0, 0) $button1 = GUICtrlCreateButton("4610", 30, 80, 100, 20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_Event_Close Exit Case $msg = $button1 $hChild = GUICreate("4610 phone", 180, 150, 100, 100) GUISetState() While 1 $msg = GUIGetMsg(1) If $msg[0] <> 0 And $msg[1] = $hChild Then Select Case $msg[0] = $GUI_Event_Close GUIDelete($hChild) ExitLoop EndSelect EndIf WEnd EndSelect WEnd Thanks, it works! 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