Triton Posted April 16, 2004 Share Posted April 16, 2004 I've got something weird going on and I'm not sure if its my code or a problem but if I Close my gui with the title bar red button it returns a -2 instead what I think It should return a -3. According to the docs its suppose to return -3 when closing with red button. any Ideas? Triton Link to comment Share on other sites More sharing options...
CyberSlug Posted April 16, 2004 Share Posted April 16, 2004 Seems to work correctly for me (Windows XP with autoit-gui.102.17) Try this example. Then remove the GUIShow line. You should only get -2 if the GUI is not visible. GUICreate("sample", 200,200) GUIShow() While 1 $msg = GuiMsg(0) ToolTip("The message is:" & $msg, 0, 0) sleep(100) If $msg = -3 Then ExitLoop WEnd MsgBox(4096,"", $msg) Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
jpm Posted April 16, 2004 Share Posted April 16, 2004 I've got something weird going on and I'm not sure if its my code or a problem but if I Close my gui with the title bar red button it returns a -2 instead what I think It should return a -3.According to the docs its suppose to return -3 when closing with red button.any Ideas?can you post a sample of your code.-2 should be return if you are in hidden state Link to comment Share on other sites More sharing options...
Triton Posted April 16, 2004 Author Share Posted April 16, 2004 (edited) I should have stated that I'm using ver 102.16 expandcollapse popupFunc maingui() $data = getdata() guicreate("SPHCS Software Installer",600,275) guisetcontrol("label","Pre-Configured Software Packages",17,13,225,20) Global $mylist = guisetcontrol("list","Software List",15,28,225,240) guisetcontroldata(-1,$data) guisetcontrol("label","To be Installed",362,13,150,20) Global $softlist = guisetcontrol("list","Software",360,28,225,240) guisetcontroldata(-1,"") Global $Reboot = guisetcontrol("checkbox","Reboot",250,150,50,20) $nRun = guisetcontrol("button","&Run",247,190,100,20) $nAdd = guisetcontrol("button",">> &Add",247,40,100,20) $nRemove = guisetcontrol("button","Re&move <<",247,80,100,20) $nExit = guisetcontrol("button","E&xit",247,230,100,20) While guimsg() >0 If guiread()= $nExit Then Exit If guiread()= $nAdd Then Add_Data() if guiread()= $nRemove Then Remove_Data() If guiread()= $nRun Then If fileexists("list.ini") Then Run_Programs() Exitloop Else msgbox(0,"ERROR","File list.ini does not exist") Endif Endif Wend $msg= guimsg(0) If $msg= -2 Then Exit Return EndFunc I just upgraded to 102.17 and still got the same result as you can see I modified my code to use -2 instead of -3 Edited April 16, 2004 by Triton Triton Link to comment Share on other sites More sharing options...
CyberSlug Posted April 16, 2004 Share Posted April 16, 2004 I think the problem might be While guimsg() >0.Try While guiMsg() <> -3. or maybe try guiMsg(0) <> -3When you click the Red X, that statement stops the loop. By the time you call $msg = GuiMsg(0), it is getting a different message, namely the message after a GUI is "closed."Or something like thatAll I know for sure is that each time you call guiMsg(), you can get a different result. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
jpm Posted April 16, 2004 Share Posted April 16, 2004 The GuiMsg(0) return -2 because it is rereading the status of the gui. The doc say the -3 is returned if you where using inside a loop GuiMsg(0). You are using Guimsg() not GuiMsg(0) in the loop. I certainly need a simpler example 2 in the doc so you can understand the difference. I hope that help Link to comment Share on other sites More sharing options...
Triton Posted April 19, 2004 Author Share Posted April 19, 2004 Ok soooo....What is the proper way to do that? I've tried a couple of different ways and did not get desired results. Thanks Triton Link to comment Share on other sites More sharing options...
jpm Posted April 19, 2004 Share Posted April 19, 2004 Ok soooo....What is the proper way to do that? I've tried a couple of different ways and did not get desired results. ThanksThat could be one way Good Gui expandcollapse popupOpt("GuiNotifyMode",1) maingui() Func maingui() $data = getdata() guicreate("SPHCS Software Installer",600,275) guisetcontrol("label","Pre-Configured Software Packages",17,13,225,20) Global $mylist = guisetcontrol("list","Software List",15,28,225,240) guisetcontroldata(-1,$data) guisetcontrol("label","To be Installed",362,13,150,20) Global $softlist = guisetcontrol("list","Software",360,28,225,240) guisetcontroldata(-1,"") Global $Reboot = guisetcontrol("checkbox","Reboot",250,150,50,20) $nRun = guisetcontrol("button","&Run",247,190,100,20) $nAdd = guisetcontrol("button",">> &Add",247,40,100,20) $nRemove = guisetcontrol("button","Re&move <<",247,80,100,20) $nExit = guisetcontrol("button","E&xit",247,230,100,20) While guimsg() >0 $msg=guiread() Select case $msg = $nExit Exit case $msg = $nAdd Add_Data() case $msg = $nRemove Remove_Data() case $msg = $nRun If fileexists("list.ini") Then Run_Programs() Exitloop Else msgbox(0,"ERROR","File list.ini does not exist") Endif Endselect Wend Return EndFunc Func getdata() return 1 EndFunc Func Add_data() EndFunc Func Remove_data() EndFunc Func Run_Programs() EndFunc 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