Sign in to follow this  
Followers 0
tweakster2010

_isChecked AND (second option changes)

2 posts in this topic

#1 ·  Posted (edited)

Ok here it is, I have a check box that more or less is for validation of separation (aka top vs bottom vs not at all)

"Not at all" removes the combobox that the other 2 choices creates. But the issue I am having is if I change "Top to"Bottom" or "Bottom to Top" the choices do not change from the ctrlsetdata like I want it to. Any insight on a way to get that change instantly?  Here is what I have so far(rough edges be gentle :))

Note: I was hoping that by setting the data to blank first it would handle that way (still learning the ins and outs per say)

Case $check
        If _IsChecked($check) And GuiCtrlRead($toporbottom) = "top" Then
        Local $combo1 = GUICtrlCreateCombo("", 25,375)
        GuiCtrlSetData($combo1, "","")
        GuiCtrlSetData($combo1,"1|2|3","")
        Local $combo2 = GuiCtrlCreateCombo("",25,410)
        GuiCtrlSetData($combo2, "a|b|c","")
        ElseIf _IsChecked($check) And GuiCtrlRead($toporbottom) = "bottom" Then
        Local $combo1 = GUICtrlCreateCombo("",25,375)
        GuiCtrlSetData($combo1, "","")
        GuiCtrlSetData($combo1,"4|5|6","")
        Local $combo2 = GuiCtrlCreateCombo("",25,410)
        GuiCtrlSetData($combo2, "a|b|c","")
    Else
        guictrlDelete($combo1)
        guictrlDelete($combo2)
    EndIf

I guess you can say I am at a loss on forcing it to change on toporbottom changing, or am I looking at the checkbox too hard now for that change?

Thanks for all the help :)

Editted to correct spelling errors :(

Edited by tweakster2010

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Figured it out, I had to add another Case to read separate for the way I was doing it, I dont know if i should have or if its bad practice but its doing exactly what I want now. :)

I am sure shorter code is possible but for me this is a solid fix for now. :)

Case $Check
        If _IsChecked($check) And GuiCtrlRead($toporbottom) = "top" Then
        Local $combo1 = GUICtrlCreateCombo("", 75,375)
        GuiCtrlSetData($combo1,"1|2|3","")
        Local $combo2 = GuiCtrlCreateCombo("",75,410)
        GuiCtrlSetData($combo2, "a|b|c","")
        ElseIf _IsChecked($check) And GuiCtrlRead($toporbottom) = "bottom" Then
        Local $combo1 = GUICtrlCreateCombo("",75,375)
        GuiCtrlSetData($combo1,"4|5|6","")
        Local $combo2 = GuiCtrlCreateCombo("",75,410)
        GuiCtrlSetData($combo2, "a|b|c","")
    Else
        guictrlDelete($combo1)
        guictrlDelete($combo2)
    EndIf
    Case $toporbottom
            GuiCtrlRead($toporbottom)
        If _IsChecked($check) And GuiCtrlRead($toporbottom) = "bottom" Then
            guictrlDelete($combo1)
            Local $combo1 = GUICtrlCreateCombo("",75,375)
            GuiCtrlSetData($combo1,"1|2|3","")
        ElseIf _IsChecked($check) And GuiCtrlRead($toporbottom) = "bottom" Then
            guictrlDelete($combo1)
            Local $combo1 = GUICtrlCreateCombo("",75,375)
            GuiCtrlSetData($combo1,"4|5|6","")
            EndIf

Fixed a typo in the example solution :)

Edited by tweakster2010

Share this post


Link to post
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
Sign in to follow this  
Followers 0