Why doesn't this work?

BlitzMax Forums/BlitzMax Programming/Why doesn't this work?

Of course, the solutions I proposed are assuming that the states kSelected, kClicked and kActive are all mutually exclusive.

If, on the other hand those states can exist simultaneously, you will need to use a bitwise or to see if any of them are active.

I'd do it like this

if ( (m_kClickState AND kSelected) OR (m_kClickState AND kClicked) OR (m_kClickState AND kActive))

The above will return true if any of the following are true

ClickState AND kSelected (true if the kSelected bit is set in clickstate)
ClickState and kClicked (true if kClicked bit is set in Clickstate)
ClickState and kActive (true if kActive bit is set)

Of course, this would require kSelected, kClicked and kActive all to have their own single bit identifier. e.g.

global kSelected = %00000001
global kClicked = %00000010
global kActive = %00000100