Sign in to follow this  
Followers 0
cmwalolo

Button Disabled/Enabled

5 posts in this topic

I'm looking for a tool that could measure time used to do some actions within multiple windows forms. I can't read in the documentation if there is some code to get some nice interaction between the current GUI and the action that need to be taken.

By example I have a form with two buttons... One is enabled, another is disabled. When I push the first button, after a certain time of processing, the second button is enabled and it should be pushed.

Is there some sample script somewhere that deals with such things, other then putting delays ... ?

Thanks for any help,

Laurent

Share this post


Link to post
Share on other sites



Welcome! :) Try this:

#include <GUIConstants.au3>

$hGui = GUICreate("Test GUI", 160, 50)

$button1 = GUICtrlCreateButton("Button1", 10, 10, 50, 25)

$button2 = GUICtrlCreateButton("Button2", 100, 10, 50, 25)
GUICtrlSetState(-1, $GUI_DISABLE)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1
            Sleep(1000)
            GUICtrlSetState($button2, $GUI_ENABLE)
            ControlClick($hGui, "", $button2)
        Case $button2
            MsgBox(0, "Msg", "Button 2 clicked")
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

$button1 = GUICtrlCreateButton("Button1", 10, 10, 50, 25)

It looks cool... But how can I do the same with controls that are not created within the script ?

Isn't there a function to get some control ?

If see GUICtrlGetHandle ( controlID ), but no parameter for the Window that contains the control.

Thank you

Laurent

Share this post


Link to post
Share on other sites

$button1 = GUICtrlCreateButton("Button1", 10, 10, 50, 25)

It looks cool... But how can I do the same with controls that are not created within the script ?

Isn't there a function to get some control ?

If see GUICtrlGetHandle ( controlID ), but no parameter for the Window that contains the control.

Thank you

Laurent

See in the help file ControlGetHandle()

Share this post


Link to post
Share on other sites

See in the help file ControlGetHandle()

Oki, but it seems that is not working with the .NET applications. Any Idea ?

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