Jump to content

Recommended Posts

Posted

Alright i have a disabled combobox ($uploadmirror) and i want to enable it when the Enable checkbox is checked ($enbau is hte checkbox) .. so i try this code...

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case GUICtrlRead($enbau) = $GUI_CHECKED
    While GUICtrlRead($enbau) = $GUI_CHECKED
        GUISetState($uploadmirror, $GUI_ENABLE)
    WEnd
    Case GUICtrlRead($enbau) = $GUI_UNCHECKED
        GUISetState($uploadmirror, $GUI_DISABLE)
    EndSelect
WEnd
Exit

No luck.. i always have trouble with check boxes :/ Any help?

Posted

i usually set these type of actions outside the case/select

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    EndSelect
    
    If GUICtrlRead($enbau) = $GUI_CHECKED Then 
        GUISetState($uploadmirror, $GUI_ENABLE)
    Else
        GUISetState($uploadmirror, $GUI_DISABLE)
    EndIf

WEnd
Exit

*** not tested

8)

NEWHeader1.png

  • Moderators
Posted (edited)

Edited for the reason of NOT READING THE POSTED CODE............. :)

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.

Posted (edited)

Doesnt seem to work :/ I think there might be a problem with the $GUI_ENABLE command?

i did not pay enough attention to your control commands...

its guictrlsetstate... not guisetstate

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    EndSelect
    
    If GUICtrlRead($enbau) = $GUI_CHECKED Then
        GUICtrlSetState($uploadmirror, $GUI_ENABLE)
    Else
        GUICtrlSetState($uploadmirror, $GUI_DISABLE)
    EndIf

WEnd
Exit

8)

... i thought SmOke would catch that right away also

Edited by Valuater

NEWHeader1.png

  • Moderators
Posted

I didn't look at it at all... that's why I didn't catch it, I would have given this example

#include <guiconstants.au3>

$main = GUICreate('main', 200, 100)
$combo = GUICtrlCreateCombo('', 10, 10, 180, 100)
$button = GUICtrlCreateButton('ENABLE/DISABLE', 50, 45, 100, 30)
$check = 1
GUICtrlSetData($combo, 'TEST|TEST2')
GUISetState()

While 1
    $Msg = GUIGetMsg()
    If $Msg = - 3 Then Exit
    If $Msg = $button Then
        If $check = 1 Then
            GUICtrlSetState($combo, $GUI_DISABLE)
            $check = 2
        ElseIf $check = 2 Then
            GUICtrlSetState($combo, $GUI_ENABLE)
            $check = 1
        EndIf
    EndIf
WEnd
If I had... I thought he was using $CBS_DROPDOWNLIST (:) me)

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.

Posted

this may be better than i previously posted, as it is not "polling" all the time

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $enbau
        If GUICtrlRead($enbau) = $GUI_CHECKED Then
            GUICtrlSetState($uploadmirror, $GUI_ENABLE)
        Else
            GUICtrlSetState($uploadmirror, $GUI_DISABLE)
        EndIf
    EndSelect
WEnd
Exit

8)

NEWHeader1.png

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...