TBCreateΒΆ
TBCreate creates a new text object.
- hText = TBCreate()
- hText = TBCreate(hTextOther)
Return Value
hText The handle of a text object. If the text object cannot be created, hText is 0.
Parameters
- hTextOther
If hTextOther is a valid text object handle the function creates a new object as a copy of the given object. If hTextOther is set to 0 a text object with default settings is created.
Example
def _CreateTextObject(hPage, hLayer, ssText, bPropFont)
{
hText = TBCreate();
if (hText == 0) {
return 0;
}
if (nargsin() == 4) {
if (bPropFont) {
hFont = FontCreate();
FontSetFaceName(hFont, "Courier New");
FontSetHeight(hFont, -10); // 10 point
FontSetWeight(hFont, FW_NORMAL);
TBSetFont(hText, hFont);
FontDestroy(hFont);
}
}
TBSetText(hText, ssText);
OBJSetEdge(hText, TRUE);
OBJSetBkMode(hText, OPAQUE);
OBJSetRoundRect(hText, FALSE);
TBSetAlignHorz(hText, LEFT);
TBSetAlignVert(hText, TOP);
// Add Text-Object to the selected layer
LayerAddObjects(hLayer, hText);
tsize = TBGetTextExtend(hText);
rvRect = OBJGetRect(hLayer);
rvRect[1] = rvRect[3] - tsize[1] - 0.5;
rvRect[2] = rvRect[4] - tsize[2] - 0.5;
rvRect[3] = tsize[1];
rvRect[4] = tsize[2];
OBJSetPosSize(hText, rvRect);
PageReplot(hPage, rvRect);
return hText;
}
History
Version |
Description |
|---|---|
5.7.0 |
hLayerOther can be set to 0. |
4.2.7 |
Function can be invoked with one parameter (copy constructor). |
See also
Overview Text Objects, TBDestroy, TBSetText, ObjCopy, OBJSetRefPointWC, ObjSetName, ObjGetName
id-337778