Jump to content

Change function of Button


lyledg
 Share

Recommended Posts

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
Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...