Jump to content

Enable/Disable


 Share

Recommended Posts

its simple, but is this correct.

#include <GUIConstants.au3>

GUICreate("My GUI state") ; will create a dialog box that when displayed is centered

$label=GUICtrlCreatebutton ("my disable label", 10,20)
GUICtrlSetState($label,$GUI_DISABLE); the label is in disable state
                
$my_boutton=GUICtrlCreateButton ("PRESS ME", 50,50)


GUISetState ()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $my_boutton
            $state=GUICtrlGetState($label)
            if $state=144 Then
                GUICtrlSetState($label,$GUI_ENABLE)
            ElseIf $state=80 then
                GUICtrlSetState($label,$GUI_DISABLE)
            EndIf
        EndSelect
Wend

Thanks again....... you guys are :D

Link to comment
Share on other sites

  • Moderators

That's fine: You could just use an "Else" statment there:

#include <GUIConstants.au3>

GUICreate("My GUI state") ; will create a dialog box that when displayed is centered

$label=GUICtrlCreatebutton ("my disable label", 10,20)
GUICtrlSetState($label,$GUI_DISABLE); the label is in disable state
                
$my_boutton=GUICtrlCreateButton ("PRESS ME", 50,50)


GUISetState ()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = - 3
            ExitLoop
        Case $msg = $my_boutton
            $state=GUICtrlGetState($label)
            if $state = 144 Then
                GUICtrlSetState($label,$GUI_ENABLE)
            Else
                GUICtrlSetState($label,$GUI_DISABLE)
            EndIf
    EndSelect
WendoÝ÷ Ø    Ýjz-êðk&®¶­sb6æ6ÇVFRfÇC´uT6öç7FçG2æS2fwC° ¤uT7&VFRgV÷C´×uT7FFRgV÷C²²vÆÂ7&VFRFÆör&÷FBvVâF7ÆVB26VçFW&V@ ¢b33c¶Æ&VÃÔuT7G&Ä7&VFV'WGFöâgV÷C¶×F6&ÆRÆ&VÂgV÷C²ÂÃ#¤uT7G&Å6WE7FFRb33c¶Æ&VÂÂb33c´uTôD4$ÄR²FRÆ&VÂ2âF6&ÆR7FFP¢¢b33c¶×ö&÷WGFöãÔuT7G&Ä7&VFT'WGFöâgV÷Cµ$U52ÔRgV÷C²ÂSÃS ¤uT6WE7FFR ¥vÆR¢b33c¶×6rÒuTvWD×6r¢6VÆV7@ 66Rb33c¶×6rÒÒ0 WDÆö÷¢66Rb33c¶×6rÒb33c¶×ö&÷WGFöà¢b&DäBuT7G&ÄvWE7FFRb33c¶Æ&VÂÂb33c´uTôD4$ÄRÒb33c´uTôD4$ÄRFVà¢uT7G&Å6WE7FFRb33c¶Æ&VÂÂb33c´uTôTä$ÄR¢VÇ6P¢uT7G&Å6WE7FFRb33c¶Æ&VÂÂb33c´uTôD4$ÄR¢VæD` VæE6VÆV7@¥vVæ@

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

k, THANKS, however, when i put this text program into my main(working on programe 500+ lines), the button i want to diable. still remains Enabled, and the whole GUI doesnt appear.

Very Bizzare.

Link to comment
Share on other sites

  • Moderators

k, THANKS, however, when i put this text program into my main(working on programe 500+ lines), the button i want to diable. still remains Enabled, and the whole GUI doesnt appear.

Very Bizzare.

I would suggest to "post" your "whole" script, it could be another issue in it entirely. You see the example working so it isn't that.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Ok. just copied the main GUI creation script, and it does the same thing.

Not show the WHOLE GUI.

AutoItSetOption("SendKeyDelay", 45);
AutoItSetOption("SendKeyDownDelay", 45);

#include <GUIConstants.au3>
Global $number_gui, $Rec, $chbx, $pice
$Form1 = GUICreate("FFXI", 175, 475, 850, 150)

$Go = GUICtrlCreateButton("Synth Recipie", 10, 40, 75, 25)
GUICtrlSetCursor($Go, 0)

$Recipie = GUICtrlCreateCombo("", 10, 8, 155, 21)
GUICtrlSetFont(-1,12)

GUICtrlSetData($Recipie, "Yagudo Drink|Selbina butter|Cinna-Cookie|Ginger-Cookie|")


$checkCN = GUICtrlCreateCheckbox("Image Support", 10, 65, 175, 25)
GUICtrlSetFont(-1,10)

$AH_seller = GUICtrlCreateButton("Sell", 10, 155, 75, 20)

$Qty_synth = GUICtrlCreateInput(0, 10, 90, 50, 20,$ES_NUMBER)
GUICtrlCreateLabel("Qty to Synth", 65, 90,100,20)
GUICtrlSetFont(-1,12)

$ah_price=GUICtrlCreateInput(0,130,155,35,20,$ES_NUMBER)
GUICtrlCreateLabel("Price", 90, 160)

GUICtrlSetFont(-1,11)

$recent = GUICtrlCreateList("", 10, 180, 155, 140, BitOR($WS_BORDER, $WS_VSCROLL))

GUICtrlCreateLabel("Log Window, Recent at Bottom", 10, 320)

$ins = GUICtrlCreateButton("Invent Sort", 10, 400, 75, 30)

$Summoner = GUICtrlCreateButton("Summoner", 10, 114, 60, 18)



$tree = GuiCtrlCreateTreeView(70,115,100,35,$TVS_CHECKBOXES+$WS_BORDER)
$auto_rest=GuiCtrlCreateTreeViewItem("Auto Sleep", $tree)
GuiCtrlSetState(-1, $GUI_CHECKED)
$cast_protect=GuiCtrlCreateTreeViewItem("With Protect II", $tree)
GuiCtrlSetState(-1, $GUI_CHECKED)

$sum_dissable = GUICtrlCreateButton("STOP!", 10, 133, 60, 18)  ;<--------------------------- This is the button i want disabled
GUISetState(-1,$GUI_DISABLE);<---------------------------doesnt work.?


GUISetState()

While 1
    $msg = GUIGetMsg()
Select  
    Case $msg = - 3
            ExitLoop
            EndSelect
WEnd

Any Ideas

BTW, thanks for speedy replies.

Link to comment
Share on other sites

  • Moderators

There's a difference between GUISetState() (Which is only for the GUI itself) and GUICtrlSetState() Which is for (Controls). Look at your "doesn't work.?", are you trying to disable the GUI itself, or the Control $sum_dissable?

$sum_dissable = GUICtrlCreateButton("STOP!", 10, 133, 60, 18)
GUICtrlSetState($sum_dissable,$GUI_DISABLE)
Is how it should be.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

There's a difference between GUISetState() (Which is only for the GUI itself) and GUICtrlSetState() Which is for (Controls). Look at your "doesn't work.?", are you trying to disable the GUI itself, or the Control $sum_dissable?

$sum_dissable = GUICtrlCreateButton("STOP!", 10, 133, 60, 18)
GUICtrlSetState($sum_dissable,$GUI_DISABLE)
Is how it should be.
you've got a good eye smoken
Link to comment
Share on other sites

  • Moderators

you've got a good eye smoken

LOL... thanks... If you make enough mistakes, they tend to stand out in everyone elses code :D , also having the 2 of them (GUISetState()'s) together made it stand out.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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