InputTextbox Method

[Top]  [Chapter]  [Previous]  [Next]

Applies to



int InputTextbox(int Width, string Text);


Creates a text box. If no text was specified the cursor will be placed within the text object layer. You can use InputText to add more text. This feature requires the "premium" license, it is always available in RTF2PDF.


After the insertion of the text box you can set the relative location using

 Memo.CurrObj.RelX = twips value;

 Memo.CurrObj.RelY = twips value;


Using CurrObj.Frame You can select the type of frame (border) which is drawn for the box.


Please note that after GotoBody the interface CurrObj cannot be used anymore.


Unless the text box support (with premium license or demo) was activated with SetEditorMode, no textbox will be created!






Width : The Width of the box in twips. The height is always determined by the contained text.

Text : The initialization text - may contain HTML or RTF tags. To create an empty box use "CLEAR". If no text was specified (except "CLEAR") the cursor will be places inside the new text box. You can fill in text and then call GotoBody when you are done.


0 if not successful. Otherwise the interface CurrObj can be used to change object properties.


Using Wrap you can change the way the text wraps around the box.


RelX and RelY are the offset coordinates (in twips) to the anchor point. By default is the anchor point the origin of the current paragraph. If you want to make the current page the origin use PositionMode = 2







  // Save writing mode, then enter some text

  int save_ch = Memo.CurrAttr.CharAttrIndex;


  for (int i = 0; i < 10; i++)

  TextCursor.InputText("text box with wrapped text ");

  Memo.CurrPar.Alignment = 3;  // justified text

  Memo.CurrObj.RelX = 3500;

  Memo.CurrObj.RelY = 720;

  Memo.CurrObj.Wrap = 4;

  Memo.CurrObj.Frame = 1;


  Memo.CurrAttr.CharAttrIndex = save_ch;

  Memo.CurrPar.Alignment = 3;

  for (int i = 0; i < 30; i++)

  TextCursor.InputText("some wrapped text ");



VB Example:


    Dim Memo As IWPMemo

    Dim Cursor As IWPTextCursor

    Set Memo = WPDLLInt1.Memo

    Set Cursor = Memo.TextCursor


    'find out how to set to set the relx to the actual cursor position.

    Dim x As Long

    Dim y As Long

    Dim page As Long

    ' this would check the mouse coordinates

    ' Memo.GetMouseXY page, x, y


    ' this checks the text cursor position

    Memo.GetXY 3, x, y



    Cursor.InputTextbox 2000"TextBox"

    ActiveForm.WPDLLInt1.Memo.CurrObj.RelX = x

    ActiveForm.WPDLLInt1.Memo.CurrObj.RelY = y


    ' relatively to page

    ActiveForm.WPDLLInt1.Memo.CurrObj.PositionMode = 2





[idh_iwptextcursor_inputtextbox.htm]    Copyright © 2007 by WPCubed GmbH