11 edittext

The keyword edittext is used to handle texts editable by the user.

Definition

{ export | reexport } { model } edittext { <Identifier> }
{
  <standard attributes>
  <plain attributes>
  <geometry attributes>
  <hierarchy attributes>
  <layout attributes>
  <text attributes>
  <scrollbar attributes>
  <object-specific attributes>
}

Within the object edittext the text cursor can be moved by the cursor control keys on the keyboard.

The Backspace key erases the character to the left of the text cursor. The Delete key erases the character to the right of the text cursor. All alphabetic and numeral keys are processed as input character.

Events

activate

charinput

cut

deselect

deselect_enter

extevent

focus

help

key

modified

paste

select

Children

document

record

transformer

Parent

groupbox

layoutbox

module

notepage

splitbox

toolbar

window

Menu

Pop-up menu

11.1 Attributes

Attribute

RLD

PID

Properties

Short Description

.acc_label

string

object

string

text

S.G/D/C

overwrites the Automation Identifier for Microsoft UI Automation

.acc_text

object

string

text

string

S.G/D/C

overwrites the Automation Name for Microsoft UI Automation

.accelerator

identifier

accel

S,G/D/C

accelerator of object

.active

boolean

boolean

S,G/D/C

activation state of an object

.alignment

integer

(-1, 0, 1)

integer

S,G/D/C

alignment of text

.bgc

identifier

color

S,G/D/C

background color

.borderraster

boolean

boolean

S,G/D/-

controls computation of geometry with active grid

.borderstyle

enum

enum

S,G/D/C

defines the style, i.e. representation and characteristics of the borders (since IDM version A.06.01.a)

.borderwidth

integer

integer

S,G/D/C

borderwidth

.class

class

class

-,G/-/-

class/id of object

.content

string

identifier

string

S,G/D/C

contents of edittext

.control

identifier

instance

-,G/-/-

control currently belonging to object

.cursor

identifier

cursor

S,G/D/C

cursor belonging to object

.cut_pending

boolean

boolean

S,G/-/-

cut operation not yet carried out

.cut_pending_changed

boolean

boolean

-,G/-/-

changing state during cut operation

.dialog

identifier

instance

-,G/-/-

dialog to which the object belongs

.document[integer]

object

document

S,G/-/-

accesses the I-th XML Document

.external

boolean

boolean

-,G/-/-

returns if the object class is an USW class

.external[integer]

class

class

-,G/-/-

returns the I-th registered USW class

.editable

boolean

boolean

S,G/D/C

editability of editable text

.endsel

integer

integer

S,G/D/C

end of the selection

.fgc

identifier

color

S,G/D/C

foreground color

.firstrecord

object

record

S,G/-/C

accesses the first record of an object

.focus

boolean

boolean

S,G/-/C

input focus on object

.font

identifier

font

S,G/D/C

object font

.format

string

identifier

string

format

S,G/D/C

format string of text

.formatfunc

identifier

func

S,G/D/C

linking of application function to edittext (for formatting)

.function

identifier

func

S,G/D/C

function belonging to object

.groupbox

identifier

instance

-,G/-/-

object groupbox

.height

integer

integer

S,G/D/C

object height

.help

string

identifier

string

text

S,G/D/C

help text of object

.hinttext string string S,G/D/C placeholder text of edittext

(see also chapter “Notes for attribute .hinttext”)

.hsb_visible

boolean

boolean

S,G/D/C

visibility of horizontal scrollbar

.index

integer

index

integer

index

-,G/-/-

current index of object in the child list of its parent

.label

string

string

S,G/D/C

name/identifier of object

.lastrecord

object

record

S,G/-/C

accesses the last record of an object

.maxchars

integer

integer

S,G/D/C

maximal number of input characters for edittext

.layoutbox

object

object

-,G/-/-

layoutbox of object

.mapped

boolean

boolean

S,G/D/-

defers the display of a visibly created object

.member[integer]

attribute

attribute

-,G/-,-

user-defined attribute [I] of object

.membercount

integer

integer

-,G/-,-

number of user-defined attributes

.menu

identifier

instance

S,G/D/C

object menu

.model

identifier

instance

S,G/D/C

model belonging to object

.multiline

boolean

boolean

S,G/D/C

multiline edittext

.navigable

boolean

boolean

S,G/D/C

focusability of edittext

.notepage

object

object

-,G/-/-

notepage which object currently belongs to

.options[enum]

boolean

boolean

S,G/D/-

special options of object

.parent

identifier

instance

S,G/-/-

parent of object

.posraster

boolean

boolean

S,G/D/C

positions refer to grid

.real_height

integer

integer

-,G/-/-

real height of object

.real_modified

boolean

boolean

-,G/-/-

actual change of content

.real_sensitive

boolean

boolean

-,G/-/-

real selectivity of object

.real_visible

boolean

boolean

-,G/-/-

real visibility of object

.real_width

integer

integer

-,G/-/-

real width of object

.real_x

integer

integer

-,G/-/-

real distance from left (in pixel)

.real_y

integer

integer

-,G/-/-

real distance from top (in pixel)

.record[integer]

object

record

S,G/-/C

accesses the I-th record of an object

.recordcount

integer

integer

-,G/-/-

queries the number of child records

.scope

integer
(1, 2, 3)

scope

-,G/-/-

queries the object type (Default, Model or instance)

.sensitive

boolean

boolean

S,G/D/C

selectivity of object

.sizeraster

boolean

boolean

S,G/D/C

size refers to grid of parent object

startsel

integer

integer

S,G/D/C

start of the selection

.statushelp

string

object

string

text

S,G/-/C

text to be displayed in statusbar

.textwidth

integer

integer

S,G/D/C

text width of an RTF edittext (see also chapter “Attribute .textwidth”)

.toolbar

object

object

-,G/-/-

toolbar of object

.toolhelp

string

object

string

text

S,G/D/C

gives a short explanation of object at the cursor

.userdata

anyvalue

anyvalue

S,G/D/C

object userdata (any DM datatype)

.visible

boolean

boolean

S,G/D/C

visibility of object

.vsb_visible

boolean

boolean

S,G/D/C

visibility of vertical scrollbar

.width

integer

may be 0

integer

S,G/D/C

actual width of object

.window

identifier

instance

-,G/-/-

window to which object belongs

.xauto

integer

(-1, 0, 1)

integer

S,G/D/C

definition type of x-coordinates

.xleft

integer

integer

S,G/D/C

x-coordinate, distance from left

.xmargin

integer

integer

S,G/-/-

right and left spacing between the edges of the layoutbox and the children can be set

.xright

integer

integer

S,G/D/C

x-coordinate, distance from right

.yauto

integer

(-1, 0, 1)

integer

S,G/D/C

definition type of y-coordinates

.ybottom

integer

integer

S,G/D/C

y-coordinate, distance from bottom

.ymargin

integer

integer

S,G/-/-

upper and lower spacing between the edges of the layoutbox and the children can be set

.ytop

integer

integer

S,G/D/C

y-coordinate, distance from top

11.2 Specific Attributes

Standard Attributes

The attribute .active defines whether the edittext is to have the current focus.

Text Attributes

The text displayed in the edittext array is defined with .content.

The attribute .real_modified indicates, whether the content actually has changed since the edittext has received the focus.

Scrollbar Attributes

The edittext can be supplied with the scrollbar attributes only if .multiline = true:

The attributes .hsb_visible and .vsb_visible define whether an edittext is to have scrollbars or not.

Layout Attributes

.borderstyle

Attribute is supported, but only border_none and border_toolkit are permitted. border_plain, border_raised and border_sunken are mapped to border_toolkit.

11.2.1 Notes for attribute .hinttext

This attribute is supported only by Windows and Qt.

For the edittext object on Windows, .hinttext is supported only if the attributes .multiline and .options[opt_rtf] have the value false.

11.3 Editable Text with Formatting (RTF edittext)

On Microsoft Windows, the edittext has an additional mode to support formatted text in Rich Text Format (RTF). This mode is activated by setting .options[opt_rtf] = true.

RTF is a text format specified by Microsoft that contains formatting instructions. RTF files can be edited, for example, with the Windows program WordPad, Microsoft Office Word and the Writer of OpenOffice or LibreOffice.

11.3.1 Particularities of Certain Attributes

The function of the attributes in the RTF edittext corresponds largely to their function in an edittext without formatting. However, for some attributes, there are particularities to be considered that are related to the fact that the content string – that is, the value of the .content attribute – and the displayed text differ.

The content string contains formatting instructions such as \i, \ul, and \par, which are not displayed as text, but in the mentioned examples cause the text in the display to be italic, underlined, or in a new paragraph. The RTF edittext may also restructure the content string, for example, by adding information to the RTF header.

This means that there are particularities for attributes where the text length or position in the text matters:

11.3.2 Attribute .textwidth

The maximum width for the text in the RTF edittext can be defined independently from the width of the edittext. Setting the text width for example may be useful to make the alignment of texts (left-aligned, right-aligned or centered) visible.

With the .textwidth attribute the maximum text width can be set and queried. If .textwidth is set to a value <= 0, the text width is calculated automatically and depends on the visibility of the horizontal scrollbar. The details are described at the attribute .textwidth in the “Attribute Reference”.

11.3.3 Editing and Formatting Content

The content of an RTF edittext can be modified with the method :replacetext(). The method :gettext() can be used to retrieve text and :findtext() can be used to search for text in the content. :replacetext() can insert plain, unformatted text or text in RTF format, :gettext() can return the retrieved text in both formats. To format text or query its formatting, the methods :setformat() and :getformat() are available.

These methods are explained in the “Method Reference”.

Depending on the font, it may happen that formatting instructions or formatting attributes set with :setformat() are ignored by the Windows object that the IDM uses for the RTF edittext. On Windows 7, this happens, for example, with text_bold if no font is set explicitly and therefore the System font is used implicitly.

11.4 Example

Single-line Edittext

window MAIN

{

  child edittext Input

  {

    .xleft    10;

    .ytop     10;

    .width    100;

    .content  "This is the edittext";

  }

}

Figure 13-7: Edittext

Multi-line Edittext:

window Input

{

  child edittext PE_Editor

  {

    .xleft      20;

    .ytop       20;

    .visible    true;

    .width      80;

    .height     15;

    .maxchars   2000;

    .multiline  true;

    .content    "You can enter a lot of rows in this field.";

  }

}

Figure 13-8: Multi-line Edittext