I wrote these two lines of code, which flip the check state of a menu item between %MF_CHECKED (&H8) and %MF_UNCHECKED (&H0).
It works, but only because one of the two values was a zero, making it possible to use the IsFalse the way I did.
Is there a more common approach used in PowerBASIC land? In my previous world, the two values were 0/1 and accessed directly as a property, making the flip an easy one line of code.
If both values were non-zero, this longer code would also work:
But elegant it's not.
Just thought I'd see if there was a common, simpler approach that I've not run across.
It works, but only because one of the two values was a zero, making it possible to use the IsFalse the way I did.
Code:
Menu Get State hMenuOptions, ByCmd %ID_Backup To iReturn Menu Set State hMenuOptions, ByCmd %ID_Backup, Abs(IsFalse iReturn)*8
If both values were non-zero, this longer code would also work:
Code:
IF iState = 1stvalue Then iState = 2ndValue Else iState = 1stValue End if
Just thought I'd see if there was a common, simpler approach that I've not run across.
Comment