OBJSetPosSizeΒΆ
OBJSetPosSize sets the position and size of a drawing object or diagram.
- bool = OBJSetPosSize(hobj, rvPosSize)
Return Value
If the function succeeds, the return value bool is TRUE (1); otherwise it is FALSE (0).
Parameters
- hobj
hobj identifies a line, text, rectangle, ellipse, table or layer (diagram) object.
- rvPosSize
rvPosSize is a vector with 4 elements:
Value
Meaning
rvPosSize[1]
x-coordinate of the left corner in centimeters
rvPosSize[2]
y-coordinate of the lower corner in centimeters
rvPosSize[3]
width of the drawing object in centimeters
rvPosSize[4]
height of the drawing object in centimeters
Example
hDoc = DocCreate()
hPage = PageCreate()
DocAddPage(hDoc, hPage);
hLayer = LayerCreate()
PageAddLayer(hPage, hLayer)
hRb = RBCreate()
LayerAddObjects(hLayer, hRb)
OBJSetPosSize(hRb, [3, -8, 3, 3])
OBJSetSelect(hRb, FALSE) // Deselect Object
PageReplot(hPage)
Set size:
hDoc = DocCreate()
hPage = PageCreate()
DocAddPage(hDoc, hPage);
hLayer = LayerCreate()
PageAddLayer(hPage, hLayer)
hTable = TableCreate(["Title1:", "A longer line of text"; ..
"Title2:", "A longer line of text"; ..
"Title3:", "A longer line of text"]);
rmAttrib = TableGetAttrib(hTable);
rmAttrib[;1] = rmAttrib[;1] | (TABLE_AUTOSIZE_WIDTH | TABLE_AUTOSIZE_HEIGHT);
rmAttrib[;2] = rmAttrib[;2] | (TABLE_AUTOSIZE_WIDTH | TABLE_AUTOSIZE_HEIGHT | TABLE_WORDWRAP);
TableSetAttrib(hTable, rmAttrib);
TableSetColumnWidth(hTable, [2, 3]);
// Because we don't know the size of the table in centimeters, we ask for the
// size:
rvPS = OBJGetPosSize(hTable);
// We want a distance of 2 centimeters the top/left corner to the paper
// but we have to specify the left/bottom corner of the table
// OBJSetRefPoint(hTable, LEFT | TOP),
OBJSetPosSize(hTable, [2, -2-rvPS[4], rvPS[3], rvPS[4]]);
// If the column size is modified we want the top/left corner to be anchored:
OBJSetRefPoint(hTable, LEFT | TOP);
OBJSetSelect(hTable, FALSE) // Deselect Object
LayerAddObjects(hLayer, hTable)
PageReplot(hPage)
See also
id-622093