Edit

(System Library)

Description: Draws an edit field with (optional) title or bevel or both.
Returns: Nothing
Usage: Steady State only.
Function Groups: Graphics
Related to: Bevel | CheckBox | ColorSelect | DropList | DropTree | FileChooser | GridList | HScrollbar | Listbox | RadioButtons | SpinBox | SplitList | ToolBar | VScrollbar
Format: System.Edit(X1, Y1, X2, Y2, Title, Variable [, FocusID, Trigger, View, DataType, DrawBevel, VertAlign, AlignTitle, LowLimit, HighLimit, Style, PrefixValue, SuffixValue, BGColor, FGColor, FontParm, TitleBGColor, TitleFGColor, BevelColor, PlaceHolder, HeightOut])
Parameters:  
X1
Required. Any numeric expression giving the X coordinate on the screen of one side of the edit field.
Y1
Required. Any numeric expression giving the Y coordinate on the screen of either the top or bottom of the edit field.
X2
Required. Any numeric expression giving the X coordinate on the screen of the side of the edit field opposite to X1.
Y2
Required. Any numeric expression giving the Y coordinate on the screen of the top or bottom of the edit field, whichever is the opposite of Y1.
Title
Required. Any text expression to be used as a title for the field.
Variable
Required. A variable whose value is set by the edit field.
FocusID
Optional. Any numeric expression from 0 to 32767 for the focus number of this graphic. If this value is 0, the edit field will display its current setting, but its value will not be able to be changed and it will appear grayed out. The default value is 1.
Trigger
Optional. Trigger provides feedback. While editing, the value will be 0. When editing is complete (tab, enter or loss of focus) the value will change to non-zero: 1 if enter is pressed, 2 otherwise.
View
Optional. Indicates how to display the edit field, as follows

View

Display Mode

0

Invisible

1

Normal (color scheme - no graying)

2

Grayed-out (only if FocusID is 0)

3Non-grayed text on a shaded background
4Gray only if ID == 0 and allow clicks to be detected by a Pick().

This parameter may be used to force an edit field with a FocusID of 0 to display normally, rather than allowing it to default to its grayed color. Note that if the FocusID is not 0, setting this value as 2 will not force the field to gray out.

The default value is 2 if FocusID is 0 and 1 otherwise.

DataType
Optional. Any numeric expression giving the type of data accepted by the edit field as follows

DataType

Description

0

Byte (unsigned)

1

Short (2 byte signed)

2

Long (4 byte signed)

3

Double precision floating point (8 byte signed)

4

Text

5

Octal (4 byte unsigned)

6

Hexadecimal (4 byte unsigned)

For types 0 - 2, if the number entered into the field is prefaced by a "0x" the value is taken to be hexadecimal format, and if it is prefaced by a "0" it is considered to be octal. In either case, the value is converted to decimal format when return is pressed or the focus is lost.

For type 5, regardless of whether the number entered into the field is prefaced by a "0" the value is taken to be octal and will be displayed as such. The actual type of Variable will be text.

Type 6, like type 5 will be kept in its declared format of hexadecimal regardless of whether the number entered into the field is prefaced by a "0x". The actual type of Variable will be text

The default value is 4 - text.

DrawBevel
Optional. Any logical expression. If true (non-0) a bevel is drawn around the edit field, if false (0) no bevel is drawn.

If the edit field is beveled, its size will become fixed and will be the same as that for a droplist. The default value is false.
VertAlign
Optional. Any numeric expression that sets the vertical alignment of the edit field according to one of the following options

VertAlign

Vertical Alignment

0

Top

1

Center

2

Bottom

Whether the title is included when the vertical alignment is calculated is determined by the value of AlignTitle. The default value is 0.

AlignTitle
Optional. Any logical expression. If true (non-0) the title is included in the calculation for vertical alignment. If false(0) it is added to the edit field after it (and its bevel if one exists) has been vertically aligned. The default is true.
LowLimit
Optional. Any expression giving the minimum value or minimum number of characters to be accepted by the edit field (depending on the data type).

This value may be a decimal, octal or hexadecimal value. If this parameter is valid and a value less than LowLimit is entered in the field (or there are too few characters, in the case of text value), the variable set by the field will revert to the previous value. No default.
HighLimit

Optional. Any numeric expression giving the maximum value or maximum number of characters to be accepted by the edit field (depending on the data type).
•   If used for numbers, the default is 255 characters.
•   If used for text, the default is 32767 characters.
The only valid lengths for text are from 0 to 65535. If you try to set a length outside that range, 32767 will be used as the maximum length.


For numeric values, the user may provide a decimal, octal or hexadecimal value. If this parameter is valid and the user enters a value greater than HighLimit in the field then the variable set by the field will revert to the previous value. No default is set. For text, users simply cannot type past the maximum character length.

Style

Optional. Default 0. Comprised of a combination of bit values to yield the desired effects. Note that some combinations should not be used as they could be mutually exclusive. For example converting input to all uppercase and to all lowercase (bits 2 and 3 both set).

Bits 0 and 1 are reserved for bit compatibility with WinComboCtrl, and should be set to "0".

Bits 2, 3 and 4 define input character handling. It is reasonable to set bit 2 and 4 or 3 and 4, but not bits 2 and 3. If not set, input is used exactly as typed.

(See: Bitwise Parameters & Operations)

Bit Number

Definition

0 Reserved for compatibility with WinComboCtrl, and should be set to "0"
1 Reserved for compatibility with WinComboCtrl, and should be set to "0"

2

Input is converted to all uppercase

3

Input is converted to all lowercase

4

Input is masked. Any characters typed will appear as asterisks. (useful for password fields)

5

Multiline editing. When set, this bit causes a typed Enter key to be interpreted as "move to the start of the next line".

Text that contains carriage-return & line-feed characters has a line break inserted at each set.

6 Reserved (Always gray when disabled, differing from WinEditCtrl)
7 Not used
8 Reserved
9 Reserved
10

Bits 10 and 11 control horizontal alignment as follows:

Bit 10 Bit 11 Alignment
0 0 Left (default)
1 0 Center
0 1 Right
1 1 Do not use
11
PrefixValue
Optional. Indicates the text expression that should be displayed immediately before (i.e. to the left of) the editable part of the control. No default.
SuffixValue
Optional. Indicates the text expression that should be displayed immediately after (i.e. to the right of) the editable part of the control. No default.
BGColor
Optional. Any numeric expression for the background color of the control. No default value.
FGColor
Optional. Any numeric expression for the foreground color of the control. No default value.
FontParm

Optional. A Font value, or the number zero. Set as "0" to use the default system font.

TitleBGColor
Optional. Background color under the title.
TitleFGColor
Optional. Foreground (text) color for the title.
BevelColor
Optional. Color of the bevel line.
PlaceHolder
Optional text. Information to display in place of invalid entry. Typically a phrase describing how the field is to be used.
HeightOut
Output. Finds the height of the field in pixels, including title and bevel if applicable.
Comments:

This module is a member of the System Library, and must therefore be prefaced by \System. as shown in the "Format" section.

If your application predates version 11.2, use the backslash notation rather than dot: \System\

The height of the edit field is constant, with X1 and X2 defining its width, and Y1 and Y2 defining the boundaries in which it is to be confined vertically, which may or may not include the added height of a title and bevel, depending on the alignment used and if they exist.
For any optional parameter that is to be set, all optional parameters preceding the desired one must be present, although they may be invalid.

Examples:

Examples often use English text in labels so that you can make a copy as a starting point when building your own version.
Better practice is to replace the text with phrase keys, and the \GetPhrase() function.

  System.Edit(10, 50 { Top left corner - fixed },
              110, 20 { Bottom right corner  }, 
              "Description" { Title }, 
              Desc { Var to update } 
              { Remainder of parameters not used, so omitted }); 
  System.Edit(20, 110, 120, 70 { Outline of field },
              "Name", Name { Title; var to update }, 
              2, DoneFlag { Focus ID, trigger },  
              Invalid { Default display }, 
              2 { Long integer values }, 
              Invalid { Default of no bevel }, 
              1 { Center the editfield }, 
              1 { Include title in alignment }, 
              Invalid { No minimum value }, 
              100 { Maximum acceptable value });