Sign in to follow this  
Followers 0
Champak

Case If problem

8 posts in this topic

#1 ·  Posted (edited)

I want to be able to check a box and it checks and disables and unchecks the rest of the boxes, and when unchecked, it enables the rest of the boxes...but it wont work. I didn't use the regular if statement because it would flicker. Can I get some help? This is what I have:

EDIT: What I mean by it wont work, after I check the main box, when I uncheck it, it wont enable the rest of them once they've been disabled.

Case $msg = $control40
        If BitAND(GUICtrlRead($control40), $GUI_CHECKED) Then GUICtrlSetState($control2, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control4, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control6, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control8, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control10, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control12, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control14, $GUI_DISABLE + $GUI_UNCHECKED)          
            GUICtrlSetState($control16, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control18, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control20, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control22, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control24, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control26, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control28, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control30, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control32, $GUI_DISABLE + $GUI_UNCHECKED)  
            GUICtrlSetState($control34, $GUI_DISABLE + $GUI_UNCHECKED)              
            GUICtrlSetState($control36, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control38, $GUI_DISABLE + $GUI_UNCHECKED)  
            
        Case $msg = $control40          
        If BitAND(GUICtrlRead($control40), $GUI_UNCHECKED) Then GUICtrlSetState($control2, $GUI_ENABLE)
            GUICtrlSetState($control4, $GUI_ENABLE)
            GUICtrlSetState($control6, $GUI_ENABLE)
            GUICtrlSetState($control8, $GUI_ENABLE)
            GUICtrlSetState($control10, $GUI_ENABLE)
            GUICtrlSetState($control12, $GUI_ENABLE)
            GUICtrlSetState($control14, $GUI_ENABLE)            
            GUICtrlSetState($control16, $GUI_ENABLE)
            GUICtrlSetState($control18, $GUI_ENABLE)
            GUICtrlSetState($control20, $GUI_ENABLE)
            GUICtrlSetState($control22, $GUI_ENABLE)
            GUICtrlSetState($control24, $GUI_ENABLE)
            GUICtrlSetState($control26, $GUI_ENABLE)
            GUICtrlSetState($control28, $GUI_ENABLE)
            GUICtrlSetState($control30, $GUI_ENABLE)
            GUICtrlSetState($control32, $GUI_ENABLE)    
            GUICtrlSetState($control34, $GUI_ENABLE)                
            GUICtrlSetState($control36, $GUI_ENABLE)
            GUICtrlSetState($control38, $GUI_ENABLE)

Also, how do some of you get the colors to show up in the code here.

Edited by Champak

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

First the code with colors is

[*autoit]

......

[/*autoit]

Then

Dim $var = 1
Case $msg = $control40
If $var = 1 Then
            GUICtrlSetState($control2, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control4, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control6, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control8, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control10, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control12, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control14, $GUI_DISABLE + $GUI_UNCHECKED)            
            GUICtrlSetState($control16, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control18, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control20, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control22, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control24, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control26, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control28, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control30, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control32, $GUI_DISABLE + $GUI_UNCHECKED)    
            GUICtrlSetState($control34, $GUI_DISABLE + $GUI_UNCHECKED)                
            GUICtrlSetState($control36, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control38, $GUI_DISABLE + $GUI_UNCHECKED)    
            $var = 0
Else
            GUICtrlSetState($control2, $GUI_ENABLE)
            GUICtrlSetState($control4, $GUI_ENABLE)
            GUICtrlSetState($control6, $GUI_ENABLE)
            GUICtrlSetState($control8, $GUI_ENABLE)
            GUICtrlSetState($control10, $GUI_ENABLE)
            GUICtrlSetState($control12, $GUI_ENABLE)
            GUICtrlSetState($control14, $GUI_ENABLE)            
            GUICtrlSetState($control16, $GUI_ENABLE)
            GUICtrlSetState($control18, $GUI_ENABLE)
            GUICtrlSetState($control20, $GUI_ENABLE)
            GUICtrlSetState($control22, $GUI_ENABLE)
            GUICtrlSetState($control24, $GUI_ENABLE)
            GUICtrlSetState($control26, $GUI_ENABLE)
            GUICtrlSetState($control28, $GUI_ENABLE)
            GUICtrlSetState($control30, $GUI_ENABLE)
            GUICtrlSetState($control32, $GUI_ENABLE)    
            GUICtrlSetState($control34, $GUI_ENABLE)                
            GUICtrlSetState($control36, $GUI_ENABLE)
            GUICtrlSetState($control38, $GUI_ENABLE)    
            $var = 1
EndIf
Edited by Daniel W.

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Share this post


Link to post
Share on other sites

[ A u t o i t ]

Case $msg = $control40
        If BitAND(GUICtrlRead($control40), $GUI_CHECKED) Then
            GUICtrlSetState($control2, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control4, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control6, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control8, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control10, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control12, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control14, $GUI_DISABLE + $GUI_UNCHECKED)          
            GUICtrlSetState($control16, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control18, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control20, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control22, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control24, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control26, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control28, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control30, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control32, $GUI_DISABLE + $GUI_UNCHECKED)  
            GUICtrlSetState($control34, $GUI_DISABLE + $GUI_UNCHECKED)              
            GUICtrlSetState($control36, $GUI_DISABLE + $GUI_UNCHECKED)
            GUICtrlSetState($control38, $GUI_DISABLE + $GUI_UNCHECKED)  
            
        ElseIf BitAND(GUICtrlRead($control40), $GUI_UNCHECKED) Then
            GUICtrlSetState($control2, $GUI_ENABLE)
            GUICtrlSetState($control4, $GUI_ENABLE)
            GUICtrlSetState($control6, $GUI_ENABLE)
            GUICtrlSetState($control8, $GUI_ENABLE)
            GUICtrlSetState($control10, $GUI_ENABLE)
            GUICtrlSetState($control12, $GUI_ENABLE)
            GUICtrlSetState($control14, $GUI_ENABLE)            
            GUICtrlSetState($control16, $GUI_ENABLE)
            GUICtrlSetState($control18, $GUI_ENABLE)
            GUICtrlSetState($control20, $GUI_ENABLE)
            GUICtrlSetState($control22, $GUI_ENABLE)
            GUICtrlSetState($control24, $GUI_ENABLE)
            GUICtrlSetState($control26, $GUI_ENABLE)
            GUICtrlSetState($control28, $GUI_ENABLE)
            GUICtrlSetState($control30, $GUI_ENABLE)
            GUICtrlSetState($control32, $GUI_ENABLE)    
            GUICtrlSetState($control34, $GUI_ENABLE)                
            GUICtrlSetState($control36, $GUI_ENABLE)
            GUICtrlSetState($control38, $GUI_ENABLE)
        EndIf

[ / A u t o i t ]

Share this post


Link to post
Share on other sites

same like mine or?

because you start with unchecked boxes or?


--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks to both of you, ChrisL's worked for me because I start with unchecked boxes.

Would you believe, I did the "ElseIf" before I posted. However, I didn't put the EndIf on because "If" in the cases didn't have an "EndIf". :"> Can someone tell me why that is?

Edited by Champak

Share this post


Link to post
Share on other sites

Hum i dont know what you want to say ....


--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Thanks to both of you, ChrisL's worked for me because I start with unchecked boxes.

Would you believe, I did the "ElseIf" before I posted. However, I didn't put the EndIf on because "If" in the cases didn't have an "EndIf". :"> Can someone tell me why that is?

If you have an if "something" = "Something" then "do something" this doesnt require and endif as the whole if statement is on one line

If you have several things to do or check then you use multiple lines and you need to tell it when the if statement ends

If "something = "something then

Do some stuff

Do some more stuff

Do even more stuff

Endif

This is the same for If and Else and ElseIF

If "something" = "something" then

Do some stuff

Do some more stuff

Do even more stuff

Elseif "something" = "somethingElse" then

Do some different stuff

Endif

Edited by ChrisL

Share this post


Link to post
Share on other sites

OK thanks, got ya.

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