you could use the
OR operator - which is a logical OR.
Case kSelected OR kClicked OR kActive
What you are doing is, as Bradford said, bitwise or'ing your cases together.
So while you think you are doing something like this
Case 1 (or) 2 (or) 3 (or) 4
the program sees that as "Case 7" because
1: 00000001
2: 00000010
3: 00000011
4: 00000100
----------------
=: 00000111 = 7
The
OR operator however, simply returns true when any of the conditions are true.
A handy efficiency tip is to put whatever condition is most likely to be true first in your OR sequence.
ie. Lets say you have condition 1 that is true 10% of the time, and condition 2 that is true 75% of the time. In an OR conditional statement, it is more efficient to put condition2 first, e.g.
condition2 OR condtion1
since ANY true result will cause the OR evalutation to return true. If you put condition1 first, the 90% of the time that it isn't true the program will have to check both condition1 and then condition2. Putting condition2 first will result in the OR statement ONLY checking condition2 the 75% of the time that it returns true.
The opposite is true for AND statements. Logical AND returns false when any of its test statements are false, so it's wisest to put whatever statement is most likely to return false first in the series.