lopolop Posted August 17, 2006 Posted August 17, 2006 well i kept getting a error when i was trying to read a CheckBox from a Gui in a function The Gui in the Functions was Called when you Selected Advanced Options on the menu bar, But I had it write the State of the Check box too ini when it was exited.. idk for some reason it kept saying GuiCtrlRead($CheckBox) was Undefined Variable.. Well then i decided to just Move the whole Advanced options into the other GUI and just hide it until You hit Advanced option, now when ever i hit the X to exit it exits my whole script because thats what the main GUI is suposed to do.. So any help would be great
CoePSX Posted August 17, 2006 Posted August 17, 2006 I had the same problem... This is what you must do: You're using GUIGetMsg(), and it returns $GUI_EVENT_CLOSE whenever any window in your script. But you can't differ wich one sent it. Try using: While 1 $msg = GUIGetMsg(1) ;Advanced one Select Case $msg[0] = $GUI_EVENT_CLOSE If $msg[1] = MAINWINDOW Then Exit Else ;Boo yah! EndIf Case $msg[0] = ANYTHING HERE ;Do something EndSelect WEnd When using GUIGetMsg(1) all the cases must use $msg[0], $msg won't work here. [quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"]╔══════════════════════════════╗║░░██░░░░░░░░██░░███░░░████░░░█║║░█░░█░░██░░█░░█░█░░█░█░░░░█░█░║║░█░░░░█░░█░████░███░░░██░░░█░░║║░█░░█░█░░█░█░░░░█░░░░░░░█░█░█░║║░░██░░░██░░░██░░█░░░░███░█░░░█║╚══════════════════════════════╝[/font]
lopolop Posted August 17, 2006 Author Posted August 17, 2006 (edited) i tried this... While $loop $msg = GUIGetMsg(1) If $msg[0] = $GUI_EVENT_CLOSE Or $msg = $ExitGUI Or $msg = $MenuExitGUI Then Save() If $msg[1] = $Form1 Then Exit EndIf If $msg[0] = $AdvancedFormGUI Then Save() GUISetState( @SW_HIDE, $AdvancedFormGUI) EndIf EndIf but that didnt work None of my buttons worked when i did that Edited August 17, 2006 by lopolop
lod3n Posted August 17, 2006 Posted August 17, 2006 (edited) No, the trick lies in the GUISetState command. You must specify that you are @SW_SHOWing the child GUI: expandcollapse popup#include <GUIConstants.au3> $gui = GUICreate("Parent") GUISetState (@SW_SHOW) $button = GUICtrlCreateButton ("Run Child", 10, 10) $label = GUICtrlCreateLabel ("Click a button in the child.", 10, 40) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop if $msg = $button then $result = ChildGui() if $result <> "" Then GUICtrlSetData($label,$result) EndIf WEnd func ChildGui() GUISetState(@SW_DISABLE) $child = GUICreate("Child",650,200, -1,-1,-1,$WS_EX_TOOLWINDOW,$gui) GUISwitch ($child) $button1 = GUICtrlCreateButton ("Button 1", 10, 10) $button2 = GUICtrlCreateButton ("Button 2", 10, 50) GUISetState(@SW_SHOW,$child) WinSetOnTop($child,"",1) $returnval = "" While 1 $childmsg = GUIGetMsg() If $childmsg = $GUI_EVENT_CLOSE Then ExitLoop if $childmsg = $button1 then $returnval = "Button 1" if $childmsg = $button2 then $returnval = "Button 2" if $returnval <> "" then ExitLoop WEnd GUIDelete ($child) GUISwitch ($gui) GUISetState(@SW_ENABLE) winactivate($gui) return $returnval EndFunc Edited August 17, 2006 by lod3n [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]
lopolop Posted August 17, 2006 Author Posted August 17, 2006 ok well i finally got it To read the ini file, and not give me the error. Thanks alot!
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