OBJSetRefPointWCΒΆ

OBJSetRefPointWC specifies, to which corner of the object the position coordinates refer.

bool = OBJSetRefPointWC(hobj, nRefPointWC)

Return Value

bool is TRUE (1) if the function was successful, and FALSE (0) if an error occurred.

Parameters

hobj

hobj identifies the text, rectangle or ellipse object.

nRefPointWC

nRefPointWC is an OR combination of two of the following values:

Name Value Meaning
LEFT 4 Left corner.
CENTER 2 Center between left and right corner.
RIGHT 1 Right corner.
TOP 8 Top corner.
MIDDLE 16 Center between top and bottom corner.
BOTTOM 32 Bottom corner.

Comment

Calls the OBJSetUsePosWC function.

Example

// Creates a text object with the text ssText at the position
// rvPosWC = [x,y] in diagram coordinates. The text object is
// added to the diagram hLayer.
// Example: TBCreateLabel(43, [0.002, 80], "Hello")
// Example: TBCreateLabel(43, [0.002, 80], "Hello\nLine 2", LEFT|TOP)
def TBCreateLabel(hLayer, rvPosWC, ssText, _nRefPoint)
{
   nRefPoint = CENTER | BOTTOM;
   if (nargsin() == 4) {
      nRefPoint = _nRefPoint;
   }

   htext = TBCreate();
   TBSetText(htext, ssText);
   TBSetAutoSize(htext, TRUE);
   TBSetEdgeDistance(htext, 0.03);
   OBJSetBkMode(htext, TRUE);        // OPAQUE
   OBJSetEdge(htext, FALSE); // Edge
   rsSize = TBGetTextExtend(htext);
   OBJSetPosSize(htext, [0, 0, rsSize]);
   OBJSetPosWC(htext, rvPosWC);
   OBJSetRefPointWC(htext, nRefPoint);
   LayerAddObjects(hLayer, htext);
   return htext;
}

id-1119158