SetBit - method of object Pm
Changing a bit of the variable.
SetBit(vFrom As Variant, nIndex As Integer, bValue As Boolean) As Variant
x = Pm.SetBit(vFrom, nIndex, bValue)
|vFrom||(Variant) Value whose bit has to be changed. The value must be integer (Byte, Integer, Long).|
|nIndex||(Integer) Index of the bit in the variable (zero-based index).|
|bValue||(Boolean) New value of the bit (true or false).|
It doesn't change the value of the vFrom
variable directly but it returns new value that can be put into the variable.
The method can also be called in the graphic item events for Web Panels
Setting the 20th bit in the BitMask variable
BitMask = Pm.SetBit(CLng(BitMask), 20, true)
is needed when originally the BitMask
was not of the Long
data type. If it has been, for example, Integer
then the 20th bit of the value doesn't exist and the method would fail.