DexterMorgan Posted March 22, 2008 Posted March 22, 2008 Hi! Another quick question. I want something that can detect if you click on the Gui and if you did it would change a label ($labelA) I tried this Guisetonevent($form1, "ChangeLabel") Func ChangeLabel() Guictrlsetdata($labelA,GUIctrlREAD($LabelA) - 1) EndFunc I also tried If _ispressed (01) then Guictrlsetdata($labelA,GUIctrlREAD($LabelA) - 1) Endif I knew the second one wouldnt work but did i do something wrong in the first one?? Please help me! code
Valuater Posted March 22, 2008 Posted March 22, 2008 (edited) please show the complete code you have, or a demo reproducing the problem 8) Edited March 22, 2008 by Valuater
Paulie Posted March 22, 2008 Posted March 22, 2008 (edited) Is this what you want to happen? #include <GUIConstants.au3> Opt("GuiOnEventMode",1) $Form = GUICreate("Click to Update", 200, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "quit") GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "UpdateInput") $Input = GUICtrlCreateInput("1", 32, 32, 136, 21,BitOr( $ES_Number,$ES_Center,$ES_Readonly)) GUISetState(@SW_SHOW) While 1 Sleep(500) WEnd Func Quit() Exit EndFunc Func UpdateInput() GUICtrlSetData($Input, GuiCtrlRead($Input)+1) EndFunc Edited March 22, 2008 by Paulie
DexterMorgan Posted March 22, 2008 Author Posted March 22, 2008 Is this what you want to happen? #include <GUIConstants.au3> Opt("GuiOnEventMode",1) $Form = GUICreate("Click to Update", 200, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "quit") GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "UpdateInput") $Input = GUICtrlCreateInput("1", 32, 32, 136, 21,BitOr( $ES_Number,$ES_Center)) GUISetState(@SW_SHOW) While 1 Sleep(500) WEnd Func Quit() Exit EndFunc Func UpdateInput() GUICtrlSetData($Input, GuiCtrlRead($Input)+1) EndFunc Yes, Thank you this is exactly what I needed! I thought you had to do this GUISetOnEvent($Form1, "UpdateInput") instead of this GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "UpdateInput"). Thank you And i have one more question how can i make sure a sound ( Soundplay("sound.wav") ) is playing at all times?? Thank you for your help! code
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