.. highlightlang:: us .. index:: TBCreate .. _tbcreate: TBCreate ======== .. us.tag TBCreate ENGLISH Changed427 Changed570 TB_Create :ref:`TBCreate` creates a new text object. .. function:: hText = TBCreate() hText = TBCreate(hTextOther) .. us.return **Return Value** *hText* The handle of a text object. If the text object cannot be created, *hText* is 0. .. us.params **Parameters** .. uparam:: 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. .. us.example **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; } .. us.history **History** .. list-table:: :header-rows: 1 * - Version - Description * - 5.7.0 - *hLayerOther* can be set to 0. * - 4.2.7 - Function can be invoked with one parameter (copy constructor). .. seealso:: :ref:`overview-text-objects`, :ref:`TBDestroy`, :ref:`TBSetText`, :ref:`ObjCopy`, :ref:`OBJSetRefPointWC`, :ref:`ObjSetName`, :ref:`ObjGetName` :sub:`id-337778`