Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bit operations 1

Status
Not open for further replies.

fishman13

Programmer
Jul 8, 2002
73
0
0
US
Does FoxPro have any capabilities to do bit operations. I want to write a method that will control (enable/disable) five command buttons based on one variable.

ex if variable is 3 only push button 1 and 2 is enabled
if variable is 5 only push button 1 and 3 is enabled
if variable is 31 all push buttons are enabled

Thanks for any help
 
I believe you're looking for the BITTEST function. How about:

WITH THISFORM
.cmdButton1.Enabled = BITTEST(variable, 0)
.cmdButton2.Enabled = BITTEST(variable, 1)
.cmdButton3.Enabled = BITTEST(variable, 2)
.cmdButton4.Enabled = BITTEST(variable, 3)
ENDWITH

Andy
 
Look help files for

BITCLEAR( )
BITLSHIFT( )
BITNOT( )
BITOR( )
BITRSHIFT( )
BITSET( )
BITTEST( )
BITXOR( )

You can use these funtions in bit operations. BitTest let you look for the value of a particular bit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top