Zithen Posted November 15, 2005 Share Posted November 15, 2005 have a main gui started with $intwindow from that window you hit a button and then another gui will open from this function. now the windows appear fine, but if i close the $delwindow the child, it will close but dosnt give functions back to the parent window, so to exit the parent i have to kill the autoit process. i have put a exitloop after the guidelete and before for closing the childwindow but then that just exits the hole script. I tried to follow the example but not getting the results i thought it would. $intWindow = GUICreate("script", 500, 180) expandcollapse popupFunc deltest() Global $name Global $check[20] Global $delini Global $x = 10 Global $y = 30 ;saveprinter() $name = IniReadSectionNames($file) If @error Then MsgBox(48, "Error", "Error: Can not read save file." & @CR & @CR & "Error: 1084") Else $delwindow = GUICreate("Delete Printers", 400, 230, -1, -1, -1, -1, $intWindow) For $i = 1 To $name[0] $name1 = IniRead($file, $name[$i], "name", "null") $check[$i] = GUICtrlCreateCheckbox($name1, 10, $y, 200, 10) $y = $y + 20 Next $check[0] = $i - 1 $DelLbl = GUICtrlCreateLabel("Please check the printers you would like to delete.", 80, 10, 250, 20) $DelBtnAll = GUICtrlCreateButton("Delete All", 100, 190, 70, 30) $DelBtnGo = GUICtrlCreateButton("Delete Selected", 210, 190, 85, 30) $DelBtnExit = GUICtrlCreateButton("Exit", 305, 190, 70, 30) EndIf GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $GUI_EVENT_CLOSE If $msg[1] = $delwindow Then GUISwitch($delwindow) GUIDelete() ElseIf $msg[1] = $intWindow Then GUISwitch($intWindow) GUIDelete() Exit EndIf EndSelect WEnd Exit EndFunc ;==>deltest Link to comment Share on other sites More sharing options...
Valuater Posted November 15, 2005 Share Posted November 15, 2005 i couldn't test this ... but it should work Func deltest() Global $name Global $check[20] Global $delini Global $x = 10 Global $y = 30 ;saveprinter() $name = IniReadSectionNames($file) If @error Then MsgBox(48, "Error", "Error: Can not read save file." & @CR & @CR & "Error: 1084") Else $delwindow = GUICreate("Delete Printers", 400, 230, -1, -1, BitOR($WS_POPUP,$WS_CAPTION), -1, $intWindow) For $i = 1 To $name[0] $name1 = IniRead($file, $name[$i], "name", "null") $check[$i] = GUICtrlCreateCheckbox($name1, 10, $y, 200, 10) $y = $y + 20 Next $check[0] = $i - 1 $DelLbl = GUICtrlCreateLabel("Please check the printers you would like to delete.", 80, 10, 250, 20) $DelBtnAll = GUICtrlCreateButton("Delete All", 100, 190, 70, 30) $DelBtnGo = GUICtrlCreateButton("Delete Selected", 210, 190, 85, 30) $DelBtnExit = GUICtrlCreateButton("Exit", 305, 190, 70, 30) EndIf GUISetState(@SW_SHOW) While 1 $msg2 = GUIGetMsg() Select Case $msg2 = $DelBtnExit GUIDelete($delwindow) EndSelect WEnd Exit EndFunc ;==>deltest 8) Link to comment Share on other sites More sharing options...
Zithen Posted November 15, 2005 Author Share Posted November 15, 2005 that didnt work ither..i striped almost all the code and just left the delete button that runs the other gui and the exits on the two...so its this code below. I would like to use the child windows, has to be easier in the long run, but i dont understand on why it wont close the child and not give functions back to the parent..i am baffled expandcollapse popup#include <GuiConstants.au3> #include <Process.au3> dim $intWindow DisplayGUI() Func DisplayGUI() Local $intWindow Local $intBtnExit Local $intMsg Local $intBtnDelete $intWindow = GUICreate("script", 500, 180) $intBtnDelete = GUICtrlCreateButton("Delete", 100, 130, 70, 30) $intBtnExit = GUICtrlCreateButton("Exit", 385, 130, 70, 30) GUISetState() While 1 $intMsg = GUIGetMsg() Select Case $intMsg = $GUI_EVENT_CLOSE Or $intMsg = $intBtnExit ExitLoop Case $intMsg = $intBtnDelete deltest() EndSelect WEnd GUIDelete($intWindow) EndFunc ;==>DisplayGUI Func deltest() ;saveprinter() If @error Then MsgBox(48, "Error", "Error: Can not read save file." & @CR & @CR & "Error: 1084") Else $delwindow = GUICreate("Delete Printers", 400, 230, -1, -1, BitOR($WS_POPUP,$WS_CAPTION), -1, $intWindow) $DelBtnExit = GUICtrlCreateButton("Exit", 305, 190, 70, 30) EndIf GUISetState(@SW_SHOW) While 1 $msg2 = GUIGetMsg() Select Case $msg2 = $DelBtnExit GUIDelete($delwindow) EndSelect WEnd Exit EndFunc ;==>deltest Link to comment Share on other sites More sharing options...
Valuater Posted November 15, 2005 Share Posted November 15, 2005 (edited) one little return was all it needed... very good example btw expandcollapse popup#include <GuiConstants.au3> #include <Process.au3> dim $intWindow DisplayGUI() Func DisplayGUI() Local $intWindow Local $intBtnExit Local $intMsg Local $intBtnDelete $intWindow = GUICreate("script", 500, 180) $intBtnDelete = GUICtrlCreateButton("Delete", 100, 130, 70, 30) $intBtnExit = GUICtrlCreateButton("Exit", 385, 130, 70, 30) GUISetState() While 1 $intMsg = GUIGetMsg() Select Case $intMsg = $GUI_EVENT_CLOSE Or $intMsg = $intBtnExit ExitLoop Case $intMsg = $intBtnDelete deltest() EndSelect WEnd GUIDelete($intWindow) EndFunc;==>DisplayGUI Func deltest() ;saveprinter() If @error Then MsgBox(48, "Error", "Error: Can not read save file." & @CR & @CR & "Error: 1084") Else $delwindow = GUICreate("Delete Printers", 400, 230, -1, -1, BitOR($WS_POPUP,$WS_CAPTION), -1, $intWindow) $DelBtnExit = GUICtrlCreateButton("Exit", 305, 190, 70, 30) EndIf GUISetState(@SW_SHOW) While 2 $msg2 = GUIGetMsg() Select Case $msg2 = $DelBtnExit GUIDelete($delwindow) Return EndSelect WEnd Exit EndFunc;==>deltest 8) Edited November 15, 2005 by Valuater Link to comment Share on other sites More sharing options...
Zithen Posted November 15, 2005 Author Share Posted November 15, 2005 bah...then dang sneaky returns lol... thanks Valuater Link to comment Share on other sites More sharing options...
billym Posted December 3, 2005 Share Posted December 3, 2005 I was looking for an example like this but what I am needing is for the parent to be always on top. In the case where there is a child window to the top most parent, the child would normally display on top of the parent but it is not happening. Could someone take a look and tell me what I am doing wrong. #include <GuiConstants.au3> #include <Process.au3> dim $intWindow DisplayGUI() Func DisplayGUI() Local $intWindow Local $intBtnExit Local $intMsg Local $intBtnDelete $X = BitOr($WS_POPUP, $WS_BORDER) $intWindow = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $X, $WS_EX_TOPMOST) $intBtnDelete = GUICtrlCreateButton("Delete", 100, 130, 70, 30) $intBtnExit = GUICtrlCreateButton("Exit", 385, 130, 70, 30) GUISetState() While 1 $intMsg = GUIGetMsg() Select Case $intMsg = $GUI_EVENT_CLOSE Or $intMsg = $intBtnExit ExitLoop Case $intMsg = $intBtnDelete deltest() EndSelect WEnd GUIDelete($intWindow) EndFunc;==>DisplayGUI Func deltest() ;saveprinter() If @error Then MsgBox(48, "Error", "Error: Can not read save file." & @CR & @CR & "Error: 1084") Else $delwindow = GUICreate("Delete Printers", 400, 230, -1, -1, BitOR($WS_POPUP,$WS_CAPTION), -1, $intWindow) $DelBtnExit = GUICtrlCreateButton("Exit", 305, 190, 70, 30) EndIf GUISetState(@SW_SHOW) While 2 $msg2 = GUIGetMsg() Select Case $msg2 = $DelBtnExit GUIDelete($delwindow) Return EndSelect WEnd Exit EndFunc;==>deltest Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 4, 2005 Moderators Share Posted December 4, 2005 I was looking for an example like this but what I am needing is for the parent to be always on top. In the case where there is a child window to the top most parent, the child would normally display on top of the parent but it is not happening. Could someone take a look and tell me what I am doing wrong. Ok, I bolded that print, because, either your contradicting yourself, or I am exhausted! (Probably the latter) But I've read that thing 20 x's now! I'm sure Valauter would have fixed more, but you'll see I did a few things... 1. Disabled the "Parent" GUI when calling the other 2. Gave the "Child" Top Most 3. Your "If/Else" statement had the While Loop outside the EndIf, if the error was thrown, then it would still do the "While loop". 4. Changed the "While 2" to "While 1" 5. Took out the Return "loan" value and replaced it with "ExitLoop" because you weren't returning a value. 6. Put the "Exit" outside the functions, so it would "Exit" when finished. and took out a few captions here and there. (Oh, and used Tidy and [ code ] [ /code ] tags!!) expandcollapse popup#include <GuiConstants.au3> #include <Process.au3> dim $intWindow DisplayGUI() Func DisplayGUI() Local $intWindow Local $intBtnExit Local $intMsg Local $intBtnDelete $X = BitOr($WS_POPUP, $WS_BORDER) $intWindow = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $X, $WS_EX_TOPMOST) $intBtnDelete = GUICtrlCreateButton("Delete", 100, 130, 70, 30) $intBtnExit = GUICtrlCreateButton("Exit", 385, 130, 70, 30) GUISetState() While 1 $intMsg = GUIGetMsg() Select Case $intMsg = $GUI_EVENT_CLOSE Or $intMsg = $intBtnExit ExitLoop Case $intMsg = $intBtnDelete GUISetState(@SW_DISABLE, $intWindow) deltest() GUISetState(@SW_ENABLE, $intWindow) EndSelect WEnd GUIDelete($intWindow) EndFunc ;==>DisplayGUI Func deltest() ;saveprinter() If @error Then MsgBox(48, "Error", "Error: Can not read save file." & @CR & @CR & "Error: 1084") Else $delwindow = GUICreate("Delete Printers", 400, 230, -1, -1, BitOR($WS_POPUP,$WS_CAPTION), $WS_EX_TOPMOST) $DelBtnExit = GUICtrlCreateButton("Exit", 305, 190, 70, 30) GUISetState() While 1 $msg2 = GUIGetMsg() Select Case $msg2 = $DelBtnExit GUIDelete($delwindow) ExitLoop EndSelect WEnd EndIf EndFunc ;==>deltest Exit Hopefully after the 20th time of reading your post, I answered it right !! 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. Link to comment Share on other sites More sharing options...
billym Posted December 4, 2005 Share Posted December 4, 2005 Thanks for the rapid response. This is a prime example of what can happen when you mix alcohol and 12 hours of nonstop development --- looks like this resolved my problem, really appreciate the help. 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