Fewmitz Posted November 10, 2007 Share Posted November 10, 2007 #include <GUIConstants.au3> Opt("GUICoordMode",2) Opt("GUIResizeMode", 1) Opt("GUIOnEventMode", 1) $parent1 = GUICreate("Parent1") $ok1 = GUICtrlCreateButton ("OK", 10, 30, 50) GUICtrlSetOnEvent(-1, "OKPressed") $cancel1 = GUICtrlCreateButton ( "Cancel", 0, -1) GUICtrlSetOnEvent(-1, "CancelPressed") GUISetState(@SW_SHOW) While 1 GuiSetState() Wend Func OKPressed() MsgBox(0, "OK Pressed", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE & " CtrlHandle=" & @GUI_CTRLHANDLE) EndFunc Yes, this was taken from the help file, but the problem is universal: My buttons return an "Unknown function name" error. They worked before, and now they don't. Why? Link to comment Share on other sites More sharing options...
toothyXdip Posted November 10, 2007 Share Posted November 10, 2007 (edited) because the CancelPressed function set by Guictrlsetonevent up top wasnt defined and i would recommend setting it up to make it exit by pressing the X =) #include <GUIConstants.au3> Opt("GUICoordMode",2) Opt("GUIResizeMode", 1) Opt("GUIOnEventMode", 1) $parent1 = GUICreate("Parent1") $ok1 = GUICtrlCreateButton ("OK", 10, 30, 50) GUICtrlSetOnEvent(-1, "OKPressed") $cancel1 = GUICtrlCreateButton ( "Cancel", 0, -1) GUICtrlSetOnEvent(-1, "CancelPressed") GUISetState(@SW_SHOW) While 1 GuiSetState() Wend Func OKPressed() MsgBox(0, "OK Pressed", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE & " CtrlHandle=" & @GUI_CTRLHANDLE) EndFunc Func CancelPressed() Exit EndFunc Edited November 10, 2007 by toothyXdip ---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝'''║'''╝╝║'''║......║'''║'''║'''║'''''''''║'''''''''║'''║---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''╝''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝ Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted November 10, 2007 Share Posted November 10, 2007 My Buttons also stopped working today.. my daughter was trying to be nice an hand me my beer... bye bye notebook .. Best regards,Emiel Wieldraaijer 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