Jump to content

Help with Disabling a Control


HockeyFan
 Share

Recommended Posts

OK, it's Monday, it's raining...and I need an extra set of eyes to look at my script. :P

What I am trying to do is have the "OK" button in my script be disabled until text is typed in the "Last Name" {$InputlastName} Input box. Can someone take a look and see what I'm missing? :D

#include <GuiConstants.au3>
#include <Misc.au3>
Opt("GUIOnEventMode", 1)
$font = "Arial Bold"
WinMinimizeAll()
GuiCreate("", 400, 316,-1, -1 , $WS_EX_TOPMOST)
GUISetBkColor (0xFFFFFF)
$GUIMainText = GuiCtrlCreateLabel("Please type the following information: ", 20, 20, 350, 30)
GUICtrlSetFont(-1, 14, 400, 0, $font)
GUICtrlSetColor ($GUIMainText, 0xFF0000)
$LabelFirstName = GuiCtrlCreateLabel("First Name:", 20, 70, 350, 20)
GUICtrlSetFont(-1, 12, 400, 0, $font)
$InputFirstName = GuiCtrlCreateInput("", 20, 90, 350, 30)
GUICtrlSetFont(-1, 12, 400, 0, $font)
GUICtrlSetColor ($InputFirstName, 0x0033FF)
$LabelLastName = GuiCtrlCreateLabel("Last Name:", 20, 140, 350, 20)
GUICtrlSetFont(-1, 12, 400, 0, $font)
$InputlastName = GuiCtrlCreateInput("", 20, 160, 350, 30)
GUICtrlSetFont(-1, 12, 400, 0, $font)
GUICtrlSetColor ($InputlastName, 0x0033FF)
$OKButton6 = GuiCtrlCreateButton("OK", 135, 225, 120, 30)
GUICtrlSetOnEvent($OKButton6, "OKButton")
GuiSetState()

ControlDisable("Please type the following information: ", "OK", 8)

$dll = DllOpen("C:\WINDOWS\system32\user32.dll")
$TypedName = GUICtrlRead($InputlastName)
Do
    Sleep(100)
    $TypedName = GUICtrlRead($InputlastName)
Until $TypedName <> ""
ControlEnable("Please type the following information: ", "OK", 8)
DllClose($dll)

While 1
    Sleep(10)
WEnd
Exit

Func OKButton()
    Exit
EndFunc

Thank you once again!! :)

Link to comment
Share on other sites

:P

Hello............anybody out there?? :D

Nope, no one here

#include <GuiConstants.au3>
#include <Misc.au3>
Opt("GUIOnEventMode", 1)
$font = "Arial Bold"
WinMinimizeAll()
GuiCreate("", 400, 316,-1, -1 , $WS_EX_TOPMOST)
GUISetBkColor (0xFFFFFF)
$GUIMainText = GuiCtrlCreateLabel("Please type the following information: ", 20, 20, 350, 30)
GUICtrlSetFont(-1, 14, 400, 0, $font)
GUICtrlSetColor ($GUIMainText, 0xFF0000)
$LabelFirstName = GuiCtrlCreateLabel("First Name:", 20, 70, 350, 20)
GUICtrlSetFont(-1, 12, 400, 0, $font)
$InputFirstName = GuiCtrlCreateInput("", 20, 90, 350, 30)
GUICtrlSetFont(-1, 12, 400, 0, $font)
GUICtrlSetColor ($InputFirstName, 0x0033FF)
$LabelLastName = GuiCtrlCreateLabel("Last Name:", 20, 140, 350, 20)
GUICtrlSetFont(-1, 12, 400, 0, $font)
$InputlastName = GuiCtrlCreateInput("", 20, 160, 350, 30)
GUICtrlSetFont(-1, 12, 400, 0, $font)
GUICtrlSetColor ($InputlastName, 0x0033FF)
$OKButton6 = GuiCtrlCreateButton("OK", 135, 225, 120, 30)
GUICtrlSetOnEvent($OKButton6, "OKButton")
GUICtrlSetState($OKButton6, $GUI_DISABLE)
GuiSetState()

;~ ControlDisable("Please type the following information: ", "OK", 8)

$dll = DllOpen("C:\WINDOWS\system32\user32.dll")
$TypedName = GUICtrlRead($InputlastName)
Do
    Sleep(100)
    $TypedName = GUICtrlRead($InputlastName)
Until $TypedName <> ""
;~ ControlEnable("Please type the following information: ", "OK", 8)
GUICtrlSetState($OKButton6, $GUI_ENABLE)
DllClose($dll)

While 1
    Sleep(10)
WEnd
Exit

Func OKButton()
    Exit
EndFunc

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

:)

:P

:)

Neveremind...I finally figured out what my mistake was. It helps to just walk away some times.. :D

I was calling the wrong title. My script should have been:

ControlDisable("", "OK", 8)

:">

There's no need to use ControlDisable etc.... when your disabling/enabling controls with-in the script, see my above post.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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...