Jump to content

[ ? ] can I change the CheckBox State?


star2
 Share

Recommended Posts

hi PPL it's me again Mr. too much questions

this is my GUI tell me where I went wrong

#include <GUIConstants.au3>
GUICreate("test", 350, 160)
GUISetFont(10)
GUICtrlCreateLabel("test-1 ", 10, 70)
GUICtrlSetFont(-1, 12, 600)
GUICtrlCreateLabel("test-2 ", 220, 70)
GUICtrlSetFont(-1, 12, 600)
$DISABLE = GUICtrlCreateCheckbox("Disable CheckBox", 10, 10)
$check_1 = GUICtrlCreateCheckbox("testing 2", 10, 40)
$put_1 = GUICtrlCreateInput("", 10, 100, 200, 25, $GUI_DISABLE)
$put_2 = GUICtrlCreateInput("", 220, 100, 70, 25, $GUI_DISABLE)
$do = GUICtrlCreateButton("Do", 300, 100, 40, 25)
GUICtrlSetFont(-1, 12, 600)
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    Select
       Case GUICtrlRead($check_1) = 1
            If Not BitAND(GUICtrlGetState($put_1), $GUI_ENABLE) then GUICtrlSetState($put_1, $GUI_ENABLE)
            If Not BitAND(GUICtrlGetState($put_2), $GUI_ENABLE) then GUICtrlSetState($put_2, $GUI_ENABLE)
        Case GUICtrlRead($check_1) = 4
            If Not BitAND(GUICtrlGetState($put_1), $GUI_DISABLE) then GUICtrlSetState($put_1, $GUI_DISABLE)
            If Not BitAND(GUICtrlGetState($put_2), $GUI_DISABLE) then GUICtrlSetState($put_2, $GUI_DISABLE)
    EndSelect
    If BitAND(GUICtrlRead($DISABLE), $GUI_CHECKED) = 1 Then
        GUICtrlSetState ($check_1,$WS_DISABLED)
    Else
        GUICtrlSetState ($check_1,-1)
    EndIf
    If $msg = $do Then
        If BitAND(GUICtrlRead($check_1), $GUI_CHECKED) = 1 Then
            MsgBox(-1, "info", "checked")
        Else
            MsgBox(-1, "info", "un-checked")
        EndIf
    EndIf
WEnd

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Link to comment
Share on other sites

GuiCtrlSetState ($checkbox, $GUI_CHECKED)

GuiCtrlSetState ($checkbox, $GUI_UNCHECKED)

The script needs this to work:

If BitAND(GUICtrlRead($DISABLE), $GUI_CHECKED) = 1 Then
        GUICtrlSetState ($check_1,$GUI_DISABLE)
    Else
        GUICtrlSetState ($check_1,$GUI_ENABLE)
    EndIf
Edited by enaiman

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

GuiCtrlSetState ($checkbox, $GUI_CHECKED)

GuiCtrlSetState ($checkbox, $GUI_UNCHECKED)

The script needs this to work:

If BitAND(GUICtrlRead($DISABLE), $GUI_CHECKED) = 1 Then
        GUICtrlSetState ($check_1,$GUI_DISABLE)
    Else
        GUICtrlSetState ($check_1,$GUI_ENABLE)
    EndIf
thank you it worked fine but it's flickering. Edited by star2

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Link to comment
Share on other sites

I've tried to do it like this but no hope

#include <GUIConstants.au3>
GUICreate("test", 350, 160)
GUISetFont(10)
GUICtrlCreateLabel("test-1 ", 10, 70)
GUICtrlSetFont(-1, 12, 600)
GUICtrlCreateLabel("test-2 ", 220, 70)
GUICtrlSetFont(-1, 12, 600)
$DISABLE = GUICtrlCreateCheckbox("Disable CheckBox", 10, 10)
$check_1 = GUICtrlCreateCheckbox("testing 2", 10, 40)
$put_1 = GUICtrlCreateInput("", 10, 100, 200, 25, $GUI_DISABLE)
$put_2 = GUICtrlCreateInput("", 220, 100, 70, 25, $GUI_DISABLE)
$do = GUICtrlCreateButton("Do", 300, 100, 40, 25)
GUICtrlSetFont(-1, 12, 600)
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    Select
       Case GUICtrlRead($check_1) = 1
            If Not BitAND(GUICtrlGetState($put_1), $GUI_ENABLE) then GUICtrlSetState($put_1, $GUI_ENABLE)
            If Not BitAND(GUICtrlGetState($put_2), $GUI_ENABLE) then GUICtrlSetState($put_2, $GUI_ENABLE)
        Case GUICtrlRead($check_1) = 4
            If Not BitAND(GUICtrlGetState($put_1), $GUI_DISABLE) then GUICtrlSetState($put_1, $GUI_DISABLE)
            If Not BitAND(GUICtrlGetState($put_2), $GUI_DISABLE) then GUICtrlSetState($put_2, $GUI_DISABLE)
            
            Case GUICtrlRead($DISABLE) = 1
            If Not BitAND(GUICtrlGetState($check_1), $GUI_UNCHECKED) then GUICtrlSetState($check_1, $GUI_UNCHECKED)
            If Not BitAND(GUICtrlGetState($check_1), $GUI_DISABLE) then GUICtrlSetState($check_1, $GUI_DISABLE)
        Case GUICtrlRead($DISABLE) = 4
            If Not BitAND(GUICtrlGetState($check_1), $GUI_ENABLE) then GUICtrlSetState($put_1, $GUI_ENABLE)
    EndSelect
    If $msg = $do Then
        If BitAND(GUICtrlRead($check_1), $GUI_CHECKED) = 1 Then
            MsgBox(-1, "info", "checked")
        Else
            MsgBox(-1, "info", "un-checked")
        EndIf
    EndIf
WEnd

please anyone help

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Link to comment
Share on other sites

Not sure exactly how you want it to work, but this works a little better IMO.

#include <GUIConstants.au3>

GUICreate("test", 350, 160)
GUISetFont(10)
GUICtrlCreateLabel("test-1 ", 10, 70)
GUICtrlSetFont(-1, 12, 600)
GUICtrlCreateLabel("test-2 ", 220, 70)
GUICtrlSetFont(-1, 12, 600)
$DISABLE = GUICtrlCreateCheckbox("Disable CheckBox", 10, 10)
$check_1 = GUICtrlCreateCheckbox("testing 2", 10, 40)
$put_1 = GUICtrlCreateInput("", 10, 100, 200, 25, $GUI_DISABLE)
$put_2 = GUICtrlCreateInput("", 220, 100, 70, 25, $GUI_DISABLE)
$do = GUICtrlCreateButton("Do", 300, 100, 40, 25)
GUICtrlSetFont(-1, 12, 600)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    Select
        Case $msg = $check_1
            If GUICtrlRead($check_1) = $GUI_CHECKED Then
                ; Enable input controls
                If BitAND(GUICtrlGetState($put_1), $GUI_ENABLE) <> $GUI_ENABLE Then
                    GUICtrlSetState($put_1, $GUI_ENABLE)
                EndIf
                If BitAND(GUICtrlGetState($put_2), $GUI_ENABLE) <> $GUI_ENABLE Then
                    GUICtrlSetState($put_2, $GUI_ENABLE)
                EndIf
            ElseIf GUICtrlRead($check_1) = $GUI_UNCHECKED Then
                ; Disable input controls
                If BitAND(GUICtrlGetState($put_1), $GUI_DISABLE) <> $GUI_DISABLE Then
                    GUICtrlSetState($put_1, $GUI_DISABLE)
                EndIf
                If BitAND(GUICtrlGetState($put_2), $GUI_DISABLE) <> $GUI_DISABLE Then
                    GUICtrlSetState($put_2, $GUI_DISABLE)
                EndIf
            EndIf
        Case $msg = $DISABLE
            If GUICtrlRead($DISABLE) = $GUI_CHECKED Then
                ; Uncheck & disable "test 2" checkbox
                If BitAND(GUICtrlGetState($check_1), $GUI_UNCHECKED) <> $GUI_UNCHECKED Then
                    GUICtrlSetState($check_1, $GUI_UNCHECKED)
                EndIf
                If BitAND(GUICtrlGetState($check_1), $GUI_DISABLE) <> $GUI_DISABLE Then
                    GUICtrlSetState($check_1, $GUI_DISABLE)
                EndIf
            ElseIf GUICtrlRead($DISABLE) = $GUI_UNCHECKED Then
                ; Check & enable "test 2" checkbox
                If BitAND(GUICtrlGetState($check_1), $GUI_CHECKED) <> $GUI_CHECKED Then
                    GUICtrlSetState($check_1, $GUI_CHECKED)
                EndIf
                If BitAND(GUICtrlGetState($check_1), $GUI_ENABLE) <> $GUI_ENABLE Then
                    GUICtrlSetState($put_1, $GUI_ENABLE)
                EndIf
            EndIf
    EndSelect
    If $msg = $do Then
        ; "Do" button checks state of "testing 2" checkbox to see if is checked
        If BitAND(GUICtrlRead($check_1), $GUI_CHECKED) = $GUI_CHECKED Then
            MsgBox(-1, "info", "checked")
        Else
            MsgBox(-1, "info", "un-checked")
        EndIf
    EndIf
WEnd

Some comments can also help to read the script as to explaining what part does what action.

:)

Link to comment
Share on other sites

@ MHz - thank you

it should be somthing like this

#include <GUIConstants.au3>

GUICreate("test", 350, 160)
GUISetFont(10)
GUICtrlCreateLabel("test-1 ", 10, 70)
GUICtrlSetFont(-1, 12, 600)
GUICtrlCreateLabel("test-2 ", 220, 70)
GUICtrlSetFont(-1, 12, 600)
$DISABLE = GUICtrlCreateCheckbox("Disable CheckBox", 10, 10)
$check_1 = GUICtrlCreateCheckbox("testing 2", 10, 40)
$put_1 = GUICtrlCreateInput("", 10, 100, 200, 25, $GUI_DISABLE)
$put_2 = GUICtrlCreateInput("", 220, 100, 70, 25, $GUI_DISABLE)
$do = GUICtrlCreateButton("Do", 300, 100, 40, 25)
GUICtrlSetFont(-1, 12, 600)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    Select
        Case $msg = $check_1
            If GUICtrlRead($check_1) = $GUI_CHECKED Then
                ; Enable input controls
                If BitAND(GUICtrlGetState($put_1), $GUI_ENABLE) <> $GUI_ENABLE Then
                    GUICtrlSetState($put_1, $GUI_ENABLE)
                EndIf
                If BitAND(GUICtrlGetState($put_2), $GUI_ENABLE) <> $GUI_ENABLE Then
                    GUICtrlSetState($put_2, $GUI_ENABLE)
                EndIf
            ElseIf GUICtrlRead($check_1) = $GUI_UNCHECKED Then
                ; Disable input controls
                If BitAND(GUICtrlGetState($put_1), $GUI_DISABLE) <> $GUI_DISABLE Then
                    GUICtrlSetState($put_1, $GUI_DISABLE)
                EndIf
                If BitAND(GUICtrlGetState($put_2), $GUI_DISABLE) <> $GUI_DISABLE Then
                    GUICtrlSetState($put_2, $GUI_DISABLE)
                EndIf
            EndIf
        Case $msg = $DISABLE
            If GUICtrlRead($DISABLE) = $GUI_CHECKED Then
                ; Uncheck & disable "test 2" checkbox
                If BitAND(GUICtrlGetState($check_1), $GUI_CHECKED) <> $GUI_CHECKED Then
                    GUICtrlSetState($check_1, $GUI_UNCHECKED)
                EndIf
                If BitAND(GUICtrlGetState($check_1), $GUI_DISABLE) <> $GUI_DISABLE Then
                    GUICtrlSetState($check_1, $GUI_DISABLE)
                EndIf
            ElseIf GUICtrlRead($DISABLE) = $GUI_UNCHECKED Then
                ; Check & enable "test 2" checkbox
                If BitAND(GUICtrlGetState($check_1), $GUI_ENABLE) <> $GUI_ENABLE Then
                    GUICtrlSetState($check_1, $GUI_ENABLE)
                EndIf
            EndIf
    EndSelect
    If $msg = $do Then
        ; "Do" button checks state of "testing 2" checkbox to see if is checked
        If BitAND(GUICtrlRead($check_1), $GUI_CHECKED) = $GUI_CHECKED Then
            MsgBox(-1, "info", "checked")
        Else
            MsgBox(-1, "info", "un-checked")
        EndIf
    EndIf
WEnd

but the problem is

the input control should start in the disabled mode !!

what I mean put_1 and put_2 when I run the script must be disabled !!

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Link to comment
Share on other sites

@ MHz - thank you

it should be somthing like this

#include <GUIConstants.au3>

GUICreate("test", 350, 160)
GUISetFont(10)
GUICtrlCreateLabel("test-1 ", 10, 70)
GUICtrlSetFont(-1, 12, 600)
GUICtrlCreateLabel("test-2 ", 220, 70)
GUICtrlSetFont(-1, 12, 600)
$DISABLE = GUICtrlCreateCheckbox("Disable CheckBox", 10, 10)
$check_1 = GUICtrlCreateCheckbox("testing 2", 10, 40)
$put_1 = GUICtrlCreateInput("", 10, 100, 200, 25, $GUI_DISABLE)
$put_2 = GUICtrlCreateInput("", 220, 100, 70, 25, $GUI_DISABLE)
$do = GUICtrlCreateButton("Do", 300, 100, 40, 25)
GUICtrlSetFont(-1, 12, 600)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    Select
        Case $msg = $check_1
            If GUICtrlRead($check_1) = $GUI_CHECKED Then
                ; Enable input controls
                If BitAND(GUICtrlGetState($put_1), $GUI_ENABLE) <> $GUI_ENABLE Then
                    GUICtrlSetState($put_1, $GUI_ENABLE)
                EndIf
                If BitAND(GUICtrlGetState($put_2), $GUI_ENABLE) <> $GUI_ENABLE Then
                    GUICtrlSetState($put_2, $GUI_ENABLE)
                EndIf
            ElseIf GUICtrlRead($check_1) = $GUI_UNCHECKED Then
                ; Disable input controls
                If BitAND(GUICtrlGetState($put_1), $GUI_DISABLE) <> $GUI_DISABLE Then
                    GUICtrlSetState($put_1, $GUI_DISABLE)
                EndIf
                If BitAND(GUICtrlGetState($put_2), $GUI_DISABLE) <> $GUI_DISABLE Then
                    GUICtrlSetState($put_2, $GUI_DISABLE)
                EndIf
            EndIf
        Case $msg = $DISABLE
            If GUICtrlRead($DISABLE) = $GUI_CHECKED Then
                ; Uncheck & disable "test 2" checkbox
                If BitAND(GUICtrlGetState($check_1), $GUI_CHECKED) <> $GUI_CHECKED Then
                    GUICtrlSetState($check_1, $GUI_UNCHECKED)
                EndIf
                If BitAND(GUICtrlGetState($check_1), $GUI_DISABLE) <> $GUI_DISABLE Then
                    GUICtrlSetState($check_1, $GUI_DISABLE)
                EndIf
            ElseIf GUICtrlRead($DISABLE) = $GUI_UNCHECKED Then
                ; Check & enable "test 2" checkbox
                If BitAND(GUICtrlGetState($check_1), $GUI_ENABLE) <> $GUI_ENABLE Then
                    GUICtrlSetState($check_1, $GUI_ENABLE)
                EndIf
            EndIf
    EndSelect
    If $msg = $do Then
        ; "Do" button checks state of "testing 2" checkbox to see if is checked
        If BitAND(GUICtrlRead($check_1), $GUI_CHECKED) = $GUI_CHECKED Then
            MsgBox(-1, "info", "checked")
        Else
            MsgBox(-1, "info", "un-checked")
        EndIf
    EndIf
WEnd

but the problem is

the input control should start in the disabled mode !!

what I mean put_1 and put_2 when I run the script must be disabled !!

Hi,

Those this modification helps?

#include <GUIConstants.au3>

GUICreate("test", 350, 160)
GUISetFont(10)
GUICtrlCreateLabel("test-1 ", 10, 70)
GUICtrlSetFont(-1, 12, 600)
GUICtrlCreateLabel("test-2 ", 220, 70)
GUICtrlSetFont(-1, 12, 600)
$DISABLE = GUICtrlCreateCheckbox("Disable CheckBox", 10, 10)
$check_1 = GUICtrlCreateCheckbox("testing 2", 10, 40)
$put_1 = GUICtrlCreateInput("", 10, 100, 200, 25, $GUI_DISABLE)
$put_2 = GUICtrlCreateInput("", 220, 100, 70, 25, $GUI_DISABLE)
$do = GUICtrlCreateButton("Do", 300, 100, 40, 25)
GUICtrlSetFont(-1, 12, 600)
GUIctrlSetState($put_1, $GUI_DISABLE)
GUIctrlSetState($put_2, $GUI_DISABLE)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    Select
        Case $msg = $check_1
            If GUICtrlRead($check_1) = $GUI_CHECKED Then
               ; Enable input controls
                If BitAND(GUICtrlGetState($put_1), $GUI_ENABLE) <> $GUI_ENABLE Then
                    GUICtrlSetState($put_1, $GUI_ENABLE)
                EndIf
                If BitAND(GUICtrlGetState($put_2), $GUI_ENABLE) <> $GUI_ENABLE Then
                    GUICtrlSetState($put_2, $GUI_ENABLE)
                EndIf
            ElseIf GUICtrlRead($check_1) = $GUI_UNCHECKED Then
               ; Disable input controls
                If BitAND(GUICtrlGetState($put_1), $GUI_DISABLE) <> $GUI_DISABLE Then
                    GUICtrlSetState($put_1, $GUI_DISABLE)
                EndIf
                If BitAND(GUICtrlGetState($put_2), $GUI_DISABLE) <> $GUI_DISABLE Then
                    GUICtrlSetState($put_2, $GUI_DISABLE)
                EndIf
            EndIf
        Case $msg = $DISABLE
            If GUICtrlRead($DISABLE) = $GUI_CHECKED Then
               ; Uncheck & disable "test 2" checkbox
                If BitAND(GUICtrlGetState($check_1), $GUI_CHECKED) <> $GUI_CHECKED Then
                    GUICtrlSetState($check_1, $GUI_UNCHECKED)
                EndIf
                If BitAND(GUICtrlGetState($check_1), $GUI_DISABLE) <> $GUI_DISABLE Then
                    GUICtrlSetState($check_1, $GUI_DISABLE)
                EndIf
            ElseIf GUICtrlRead($DISABLE) = $GUI_UNCHECKED Then
               ; Check & enable "test 2" checkbox
                If BitAND(GUICtrlGetState($check_1), $GUI_ENABLE) <> $GUI_ENABLE Then
                    GUICtrlSetState($check_1, $GUI_ENABLE)
                EndIf
            EndIf
    EndSelect
    If $msg = $do Then
       ; "Do" button checks state of "testing 2" checkbox to see if is checked
        If BitAND(GUICtrlRead($check_1), $GUI_CHECKED) = $GUI_CHECKED Then
            MsgBox(-1, "info", "checked")
        Else
            MsgBox(-1, "info", "un-checked")
        EndIf
    EndIf
WEnd

Cheers

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

Hi,

Those this modification helps?

Cheers

$put_1 = GUICtrlCreateInput("", 10, 100, 200, 25, $GUI_DISABLE)
$put_2 = GUICtrlCreateInput("", 220, 100, 70, 25, $GUI_DISABLE)
$do = GUICtrlCreateButton("Do", 300, 100, 40, 25)
GUICtrlSetFont(-1, 12, 600)
GUIctrlSetState($put_1, $GUI_DISABLE)
GUIctrlSetState($put_2, $GUI_DISABLE)
GUISetState()oÝ÷ Û'¬¶²v'azZZºÚ"µÍÌÍÜ]ÌHHÕRPÝÜX]R[]
    ][ÝÉ][ÝËLLJBÌÍÜ]ÌHÕRPÝÜX]R[]
    ][ÝÉ][ÝËL
ÌJBÌÍÙÈHÕRPÝÜX]P]Û ][ÝÑÉ][ÝËÌL
JBÕRPÝÙ]Û
LKL

BÕRXÝÙ]Ý]J  ÌÍÜ]ÌK  ÌÍÑÕRWÑTÐPJBÕRXÝÙ]Ý]J ÌÍÜ]Ì   ÌÍÑÕRWÑTÐPJBÕRTÙ]Ý]J
oÝ÷ ÚØZL¨ºÊ&¹ÈZÊ-ë#ozjøu«­¢+Ù
ÍÀÌØíµÍôÀÌØí%M  1(%U%
ÑɱI ÀÌØí%M  1¤ôÀÌØíU%}
!
-Q¡¸(ìU¹¡¬µÀì¥Í±ÅÕ½ÐíÑÍÐÈÅÕ½Ðì¡­½à(%  ¥Ñ9¡U%
ÑɱÑMÑÑ ÀÌØí¡­|Ĥ°ÀÌØíU%}
!
-¤±ÐìÐìÀÌØíU%}
!
-Q¡¸(U%
ÑɱMÑMÑÑ ÀÌØí¡­|Ä°ÀÌØíU%}U9
!
-¤($$$$%U%ÑɱMÑMÑÑ ÀÌØíÁÕÑ|Ä°ÀÌØíU%}%M  1¤($$$$%U%ÑɱMÑMÑÑ ÀÌØíÁÕÑ|È°ÀÌØíU%}%M  1¤(¹%
Edited by star2

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

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