Sign in to follow this  
Followers 0
DexterMorgan

Clicking on a gui?

5 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

please show the complete code you have, or a demo reproducing the problem

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by Paulie

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Check out the _Sound* functions

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0