Update cookies preferences
Promotic

SetSize - method of the PmBuffer object

Description:
Setting the data block size.
Syntax:
Empty SetSize(Long nNewSize, [Long nMode])
Parameters:
nNewSize(Long) New data block size specified absolutely or relatively to the current size see the nMode parameter.
nMode[optional] (Long) Specifies the behavior when the size of existing data block is changed.
0 (default) - New size of the data block entered absolutely.
The content of existing data block will not be preserved. New data block will be created and zeroed.
The value of the AutoOffset property is set to 0.
1 - New size of the data block entered absolutely.
The content of existing data block will be preserved. The existing data block will either be enlarged or reduced in size. Only the modified area will be zeroed.
The value of the AutoOffset property is kept if it is relevant in the new size, otherwise is set to 0.
2 - New size of the data block entered relatively.
The content of existing data block will be preserved. The existing data block will either be enlarged or reduced in size. Only the modified area will be zeroed.
The value of the AutoOffset property is kept if it is relevant in the new size, otherwise is set to 0.
Note:
This method is also functional in Web panels.
See also:
- PmBuffer.GetSize (method)
Example:
Creating and filling the data block, then shrinking the data block by 2 bytes with data preservation.
JavaScriptSelect and copy to clipboard

var oBuf = Pm.CreatePmBuffer();
var s1 = "40302010605070";
oBuf.SetHexaString(-2, s1);
var nSize = oBuf.GetSize();   // nSize = 7

oBuf.SetSize(-2, 2);
var val = oBuf.GetHexaString();   // val = 4030201060

History:
Pm9.00.22: The nMode parameter changed from Bool to Long, that more precisely specifies the behavior when an existing data block is changed.
Pm9.00.04: Created
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.