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) {
            hf = FontCreate();
            FontSetFaceName(hf, "Courier New");
            FontSetHeight(hf, -10); // 10 point
            FontSetWeight(hf, 400); // Normal
            TBSetFont(htext, hf);
            FontDestroy(hf);
        }
    }
    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
    rvRect = OBJGetRect(hlayer);
    LayerAddObjects(hlayer, htext);
    tsize = TBGetTextExtend(htext);
    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).

id-337778