Jump to content

To make a button unclickable for some time


Recommended Posts

I have a button, and a small input box on the left, that is @ES_READONLY andi want the button to be unclickable until the counter, the input box, reaches 0, can this be done????

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Link to comment
Share on other sites

I have a button, and a small input box on the left, that is @ES_READONLY andi want the button to be unclickable until the counter, the input box, reaches 0, can this be done????

Use GuiCtrlSetState() with $GUI_DISABLE and $GUI_ENABLE to manage the button.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I have a button, and a small input box on the left, that is @ES_READONLY andi want the button to be unclickable until the counter, the input box, reaches 0, can this be done????

I think it would look something like this:

First, to set the button disabled you would do this:

GuiCtrlSetState($button, $GUI_DISABLE)

I haven't tested this...

You might need a "GuiCtrlRead" in there but I'm not sure. Also, I'm assuming your counter goes down to 1. If this doesn't work you could post some of the script.

Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Here, try this:

#include <GUIConstants.au3>

GUICreate('', 180, 40)

$input = GUICtrlCreateInput('10', 10, 10, 20, 20, $ES_READONLY)

$btn1 = GUICtrlCreateButton('Enabled', 40, 10, 60, 20)
$btn2 = GUICtrlCreateButton('Exit', 110, 10, 60, 20)


GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $btn1
            GUICtrlSetData($btn1, 'Disabled')
            GUICtrlSetState($btn1, $GUI_DISABLE)
            GUICtrlSetState($btn2, $GUI_DISABLE)
            For $i = 9 To 1 Step - 1
                GUICtrlSetData($input, $i)
                Sleep(500)
            Next
            GUICtrlSetData($input, '10')
            GUICtrlSetData($btn1, 'Enabled')
            GUICtrlSetState($btn1, $GUI_ENABLE)
            GUICtrlSetState($btn2, $GUI_ENABLE)
        Case $btn2
            Exit
    EndSwitch
WEnd
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...