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> < > <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
Children
Parent
Menu
11.1 Attributes
Attribute |
RLD |
PID |
Properties |
Short Description |
---|---|---|---|---|
string object |
string text |
S.G/D/C |
overwrites the Automation Identifier for Microsoft UI Automation |
|
object string |
text string |
S.G/D/C |
overwrites the Automation Name for Microsoft UI Automation |
|
identifier |
accel |
S,G/D/C |
accelerator of object |
|
boolean |
boolean |
S,G/D/C |
activation state of an object |
|
integer (-1, 0, 1) |
integer |
S,G/D/C |
alignment of text |
|
identifier |
color |
S,G/D/C |
background color |
|
boolean |
boolean |
S,G/D/- |
controls computation of geometry with active grid |
|
enum |
enum |
S,G/D/C |
defines the style, i.e. representation and characteristics of the borders (since IDM version A.06.01.a) |
|
integer |
integer |
S,G/D/C |
borderwidth |
|
class |
class |
-,G/-/- |
class/id of object |
|
string identifier |
string |
S,G/D/C |
contents of edittext |
|
identifier |
instance |
-,G/-/- |
control currently belonging to object |
|
identifier |
cursor |
S,G/D/C |
cursor belonging to object |
|
boolean |
boolean |
S,G/-/- |
cut operation not yet carried out |
|
boolean |
boolean |
-,G/-/- |
changing state during cut operation |
|
identifier |
instance |
-,G/-/- |
dialog to which the object belongs |
|
object |
document |
S,G/-/- |
accesses the I-th XML Document |
|
boolean |
boolean |
-,G/-/- |
returns if the object class is an USW class |
|
class |
class |
-,G/-/- |
returns the I-th registered USW class |
|
boolean |
boolean |
S,G/D/C |
editability of editable text |
|
integer |
integer |
S,G/D/C |
end of the selection |
|
identifier |
color |
S,G/D/C |
foreground color |
|
object |
record |
S,G/-/C |
accesses the first record of an object |
|
boolean |
boolean |
S,G/-/C |
input focus on object |
|
identifier |
font |
S,G/D/C |
object font |
|
string identifier |
string format |
S,G/D/C |
format string of text |
|
identifier |
func |
S,G/D/C |
linking of application function to edittext (for formatting) |
|
identifier |
func |
S,G/D/C |
function belonging to object |
|
identifier |
instance |
-,G/-/- |
object groupbox |
|
integer |
integer |
S,G/D/C |
object height |
|
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”) |
boolean |
boolean |
S,G/D/C |
visibility of horizontal scrollbar |
|
integer index |
integer index |
-,G/-/- |
current index of object in the child list of its parent |
|
string |
string |
S,G/D/C |
name/identifier of object |
|
object |
record |
S,G/-/C |
accesses the last record of an object |
|
integer |
integer |
S,G/D/C |
maximal number of input characters for edittext |
|
object |
object |
-,G/-/- |
layoutbox of object |
|
boolean |
boolean |
S,G/D/- |
defers the display of a visibly created object |
|
attribute |
attribute |
-,G/-,- |
user-defined attribute [I] of object |
|
integer |
integer |
-,G/-,- |
number of user-defined attributes |
|
identifier |
instance |
S,G/D/C |
object menu |
|
identifier |
instance |
S,G/D/C |
model belonging to object |
|
boolean |
boolean |
S,G/D/C |
multiline edittext |
|
boolean |
boolean |
S,G/D/C |
focusability of edittext |
|
object |
object |
-,G/-/- |
notepage which object currently belongs to |
|
boolean |
boolean |
S,G/D/- |
special options of object |
|
identifier |
instance |
S,G/-/- |
parent of object |
|
boolean |
boolean |
S,G/D/C |
positions refer to grid |
|
integer |
integer |
-,G/-/- |
real height of object |
|
boolean |
boolean |
-,G/-/- |
actual change of content |
|
boolean |
boolean |
-,G/-/- |
real selectivity of object |
|
boolean |
boolean |
-,G/-/- |
real visibility of object |
|
integer |
integer |
-,G/-/- |
real width of object |
|
integer |
integer |
-,G/-/- |
real distance from left (in pixel) |
|
integer |
integer |
-,G/-/- |
real distance from top (in pixel) |
|
object |
record |
S,G/-/C |
accesses the I-th record of an object |
|
integer |
integer |
-,G/-/- |
queries the number of child records |
|
integer |
scope |
-,G/-/- |
queries the object type (Default, Model or instance) |
|
boolean |
boolean |
S,G/D/C |
selectivity of object |
|
boolean |
boolean |
S,G/D/C |
size refers to grid of parent object |
|
integer |
integer |
S,G/D/C |
start of the selection |
|
string object |
string text |
S,G/-/C |
text to be displayed in statusbar |
|
integer |
integer |
S,G/D/C |
text width of an RTF edittext (see also chapter “Attribute .textwidth”) |
|
object |
object |
-,G/-/- |
toolbar of object |
|
.toolhelp |
string object |
string text |
S,G/D/C |
gives a short explanation of object at the cursor |
anyvalue |
anyvalue |
S,G/D/C |
object userdata (any DM datatype) |
|
boolean |
boolean |
S,G/D/C |
visibility of object |
|
boolean |
boolean |
S,G/D/C |
visibility of vertical scrollbar |
|
integer may be 0 |
integer |
S,G/D/C |
actual width of object |
|
identifier |
instance |
-,G/-/- |
window to which object belongs |
|
integer (-1, 0, 1) |
integer |
S,G/D/C |
definition type of x-coordinates |
|
integer |
integer |
S,G/D/C |
x-coordinate, distance from left |
|
integer |
integer |
S,G/-/- |
right and left spacing between the edges of the layoutbox and the children can be set |
|
integer |
integer |
S,G/D/C |
x-coordinate, distance from right |
|
integer (-1, 0, 1) |
integer |
S,G/D/C |
definition type of y-coordinates |
|
integer |
integer |
S,G/D/C |
y-coordinate, distance from bottom |
|
integer |
integer |
S,G/-/- |
upper and lower spacing between the edges of the layoutbox and the children can be set |
|
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:
- .hsb_visible
- .vsb_visible
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:
- Compliant with Windows, .startsel and .endsel refer to the position of the cursor or the selection in the displayed text. It is not possible to infer the position in the content string because of the formatting instructions contained therein. For this reason, .startsel and .endsel cannot be used directly to edit the contents (.content) of the edittext.
- .format, .formatfunc and .maxchars are permitted, but not useful for multi-line texts.
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";
}
}
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.";
}
}