Jump to content

2 quick questions on combo box and checkbox


vladedoty
 Share

Recommended Posts

I know how to enable a combobox if a checkbox is checked.

but if i check it again to uncheck it i have no clue how to disable the combobox after it has been enabled

other question is how do i change text in one combo box everytime something different is selceted from a different combo box.

Link to comment
Share on other sites

Hi,

#include <GUIConstantsEx.au3>

$hGui = GUICreate(":-)", 375, 60)
$iCombo1 = GUICtrlCreateCombo("", 5, 5, 180, 20)
GUICtrlSetData(-1, "Day|Night|Morning|Afternoon", "Day")
$iCombo2 = GUICtrlCreateCombo("", 190, 5, 180, 20)
GUICtrlSetData(-1, "Day|Night|Morning|Afternoon", "Night")
$iCheckbox = GUICtrlCreateCheckbox("Disable Combo1", 5, 35, 100, 20)
GUISetState(@SW_SHOW, $hGui)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $iCombo1
            GUICtrlSetData($iCombo2, GUICtrlRead($iCombo1), GUICtrlRead($iCombo1))
        Case $iCombo2
            GUICtrlSetData($iCombo1, GUICtrlRead($iCombo2), GUICtrlRead($iCombo2))
        Case $iCheckbox
            If BitAND(GUICtrlRead($iCheckbox), $GUI_CHECKED) Then
                GUICtrlSetState($iCombo1, $GUI_DISABLE)
            Else
                GUICtrlSetState($iCombo1, $GUI_ENABLE)
            EndIf
    EndSwitch
WEnd

Cheers

Edited by smashly
Link to comment
Share on other sites

other question is how do i change text in one combo box everytime something different is selceted from a different combo box.

guictrlread() your first checkbox and then guictrlsetdata() your second checkbox. Hope it helps. If you didn't get what I mean, then I ll post a sample code. But it's pretty straightforward, what I mean.
[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
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...