Sign in to follow this  
Followers 0
lyledg

Change function of Button

4 posts in this topic

#1 ·  Posted (edited)

Hey guys

I need to change the function of a button within my script, Like a start and stop button as shown below..

#include <GUIConstants.au3>

GUICreate("Test Buttons",220,100, 100,200)
$button = GUICtrlCreateButton ("Start",75,70,70,20)
GUISetState ()


do
$msg = GUIGetMsg()
If $msg = $button Then
    GUICtrlSetData ($button,"Stop")
    $m = GUIGetMsg ()
    
    If $m = -3 Then ExitLoop
    
    If $m = $button Then
      GUICtrlSetData ($button,"Start")
    EndIf

EndIf
until $msg = $GUI_EVENT_CLOSE

Tried using and editing the example out of the help file for GUICtrlCreateProgress, but am stuck now?

Any ideas please?

Edited by lyledg

Share this post


Link to post
Share on other sites



Maybe...

#include <GUIConstants.au3>

GUICreate("Test Buttons", 220, 100, 100, 200)
$button = GUICtrlCreateButton("Start", 75, 70, 70, 20)
GUISetState()


While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then ExitLoop
    If $msg = $button Then
        If GUICtrlRead($button) = "Start" Then
            GUICtrlSetData($button, "Stop")
            ; do something ????
        Else
            GUICtrlSetData($button, "Start")
            ; do somethnig
        EndIf

    EndIf
WEnd

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Thanks Vaulater, I thought it would something very easy!

:whistle:

Share this post


Link to post
Share on other sites

Thanks Vaulater, I thought it would something very easy!

:whistle:

wELCOME

8)


NEWHeader1.png

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