Which Flag Is Set (ie 1, 2, 4,16,32,64,...)

Which Flag Is Set (ie 1, 2, 4,16,32,64,...)

Anonymous
Not applicable
403 Views
3 Replies
Message 1 of 4

Which Flag Is Set (ie 1, 2, 4,16,32,64,...)

Anonymous
Not applicable
I'm working with some code that deals with the layer states and the optional flag to determine which props to save.

Initially, I was going to store the sum of the flags using savesettings, until i realized I don't know how to "parse" the total into the individual flags. Could someone give a hint or a little code?

Edit: I need to figure out which flags are set so that i can mark the appropriate check box (just like the options for the native layer states)

Here are the codes I'm working with

acLsNone 0
acLsOn 1
acLsFrozen 2
acLsLocked 4
acLsPlot 8
acLsNewViewport 16
acLsColor 32
acLsLineType 64
acLsLineWeight 128
acLsPlotStyle 256
acLsAll 65535


TIA!
Message was edited by: Oberer
0 Likes
404 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
If RetrievedValue And acLsFrozen Then
'acLsFrozen bit is set
End If

If RetrievedValue And acLsColor Then
'acLsColor bit is set
End If
0 Likes
Message 3 of 4

Anonymous
Not applicable
Hi Oberer This function returns the bitwise AND: [code] Public Function MeBitwAnd(FstVal As Integer, NxtVal As Integer) As Boolean MeBitwAnd = (((FstVal And NxtVal) = NxtVal) Or (FstVal = 0)) End Function [/code] Samples: ?MeBitwAnd(9, 8) True ?MeBitwAnd(9, 2) False Cheers -- Juerg Menzi MENZI ENGINEERING GmbH, Switzerland http://www.menziengineering.ch
0 Likes
Message 4 of 4

Anonymous
Not applicable
I obviously didn't realize it was that simple 🙂

thanks!
0 Likes