SetBit - method of the Pm object

Changing a bit of the variable.
Variant SetBit(Variant vFrom, Long nIndex, Boolean bValue)
vFrom(Variant) Value whose bit has to be changed. This value must be integer (Byte, Integer, Long).
nIndex(Long) 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.

In the JavaScript language, it is better to use the standard bit operators for reading and setting the bit.

This method is functional also in Macro expression $.expr and in the onDraw event of the PmgCanvas object.
This method is also functional in Web panels.
Sets bit 20 In the BitMask variable
JavaScriptVBScriptSelect and copy to clipboard

BitMask = Pm.SetBit(BitMask, 20, true);
CLng is needed if originally the BitMask was not of the Long type. If it has been, for example, of the Integer type, then bit 20 of the value does not exist and the method would fail.

Pm8.02.13: Sometimes the bit range was not tested correctly causing some writing outside the range.
Pm8.02.09: Available for Web panels.
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
- Pm
- Abs
- Cos
- E
- Exp
- LN2
- PI
- Pow
- SetBit
- Sin
- Tan
© MICROSYS, spol. s r.o.