Rorax Posted September 21, 2006 Posted September 21, 2006 (edited) Opt("GUIOnEventMode", 1) $mainWindow = GuiCreate("Dokument", 150, 150) GuiSetState() GUICtrlCreateLabel("Ange dokumentnamn", 10, 10) $VarDokNam = GUICtrlCreateInput("Fyll i dokumentnamn", 10, 25) GuictrlSetState(-1, $GUI_FOCUS) $cancel1 = GUICtrlCreateButton ( "Avbryt", 70, 100, 50) GUICtrlSetOnEvent(-1, "CancelPressed") $ok1 = GUICtrlCreateButton ("OK", 10, 100, 50) GUICtrlSetOnEvent(-1, "OKPressed") $radio1 = GUICtrlCreateRadio ("Flatbädd", 10, 70, 120, 20) $radio2 = GUICtrlCreateRadio ("Dokumentmatare", 10, 50, 120, 20) GUICtrlSetState ($radio2, $GUI_CHECKED) While 1 Sleep(10) WEnd I can minimize the GUI with the "-" on the titlebar, but I cant close it, the "X" does nothing. First try for me using a GUI at all. Its probably something simple. Tried searching the help and guess its something with the "X" being pushed and sending $GUI_EVENT_CLOSE (or something like that) but the GUI not responding to that event. Also is there a way to close the GUI itself, or will @SW_HIDE close the GUI or just..well Hide it. As it is now I do a @SW_HIDE after I press the "OK" button and just use Exit when I press the "Cancel" button (Named: "Avbryt") Appreciate all the help I can get. Regards, Rorax Edited September 21, 2006 by Rorax
taurus905 Posted September 21, 2006 Posted September 21, 2006 Rorax, Check out GUISetOnEvent in the help file for a good example. taurus905 "Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs
Valuater Posted September 21, 2006 Posted September 21, 2006 maybe... #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $mainWindow = GUICreate("Dokument", 150, 150) GUISetOnEvent($GUI_EVENT_CLOSE, "CancelPressed") GUICtrlCreateLabel("Ange dokumentnamn", 10, 10) $VarDokNam = GUICtrlCreateInput("Fyll i dokumentnamn", 10, 25) GUICtrlSetState(-1, $GUI_FOCUS) $cancel1 = GUICtrlCreateButton("Avbryt", 70, 100, 50) GUICtrlSetOnEvent(-1, "CancelPressed") $ok1 = GUICtrlCreateButton("OK", 10, 100, 50) GUICtrlSetOnEvent(-1, "OKPressed") $radio1 = GUICtrlCreateRadio("Flatbädd", 10, 70, 120, 20) $radio2 = GUICtrlCreateRadio("Dokumentmatare", 10, 50, 120, 20) GUICtrlSetState($radio2, $GUI_CHECKED) GUISetState() While 1 Sleep(10) WEnd Func OKPressed() MsgBox(64, "Thanks...", " .... Valuater ", 3) EndFunc ;==>OKPressed Func CancelPressed() Exit EndFunc ;==>CancelPressed 8)
Rorax Posted September 21, 2006 Author Posted September 21, 2006 Ok I'm a idiot. All that was needed was. GUISetonEvent($GUI_EVENT_CLOSE, "CancelPressed") Should have added that I have functions that are being used when using the buttons Valuater but thanks anyay =) Thanks you two for taking the time to help me out
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