Windows control - Text entry field

Windows control - Text field is used to display and enter an information in text or numeric forms. It also allows to work with the information of logical type, but Windows control of Check box type is better for displaying a logical information.


Example

Example - Text entry field

To create text entry field

  1. In the Drawing toolbar click the button Text entry field Text entry field.
  2. Point the mouse cursor to the position of the first displayer corner and click.
  3. Point the mouse cursor to the position of the diametric displayer corner and click.

Text entry field parameters are being configured in the palette Connect object through the following tabs:

Connect


Connected object

Selection of an object to connect. The object determines the contents of the text entry field and vice versa - the value of the object is being changed when the user enters a new value into the text entry field and clicks other graphic object in the picture. This feature does not apply in case of the parameter RichEdit. The type of displayed value is given by the type of the object.


When you connect an object of Structured variable, you must define whose item will be displayed in the displayer. Unique item position in structured variable is defined by the column name (the parameter Column) and the row number (the parameter Row). For object of Value array, you must define which array item will be displayed in the displayer.

Script


Reference variable

Specifies the name of the text entry field in the form of reference variable for use in the picture script.

Metadata

Assignment of application data (metadata) to a graphic object. If the object contains some metadata, the name of the first record will be displayed in the button. Multiple records are indicated by ",...".

Event

The list box allows user to select an active picture event for the text entry field. The list box contains the following active picture events:

Event Handler

The button opens the active picture script to define the active picture event specified by the parameter Event.

Info text/URL


Info text

Text to display as a tooltip when user points the mouse cursor to the text entry field in the picture opened in process D2000 HI.
Possibility to use the Dictionary (to open press CTRL+L).

URL

Definition of URL address to open a web page from a picture. The address may be set also in the picture script by the function %HI_SetOBJURL.

Properties


Connect object palette - Properties tab

Text entry field may be conditioned that it must be filled in HI. If any text is not entered, the background of field matches with the color defined in application parameters. In D2000 GrEditor, the entry field is always colored according to this parameter.

Conditions for using background:

  • Optional item Optional item - no change of color (default),
  • Conditioned mandatory item Conditioned mandatory item – color set according to application parameters ColorConditionalItems
  • Mandatory item Mandatory item – color set according to application parameters ColorMandatoryItems

Text

The parameter is useless for this type of Windows control.

Visible

If the parameter is checked, the text entry field will be visible after first opening the picture in process D2000 HI. The parameter can be controlled from the script using the function %HI_SetVisible.

Disabled

If the parameter is checked, the text entry field will be disabled after first opening the picture in process D2000 HI. The parameter can be controlled from the picture script using the function %HI_SetEnable.

Group

The parameter allows you to set the text entry field as the first control of a group of Windows controls.

RichEdit

The parameter allows to open a windows control RichEdit instead of Text entry field. It enables to edit text and use more functions like more fonts and font colors. Text may be modified in the picture script by the functions.
The shortcuts are supported directly when you are writing some text: Ctrl+B - bold, Ctrl+U - underline, Ctrl+I - italic.

RichEdit enables 2 text types: formatted (it contains the format commands which control the way to display a text) and plain text without formatting.
For that reason, it is valid:
If some object is connected to EnryField, its value is visible, but a change, made by user, is not automatically set to this variable.
If some text without formatting is set into the variable, the formatting would disappear after leaving the Windows control - a new value of variable would substitute it.
If the text with formatting is set, the text would be unreadable by other means. It depends on an application to read the content when the focus loses or doing other activities.

Text length

Definition of the maximum number of characters, which can be entered into the text entry field.

Password

Displays an asterisk (*) for each character typed into the text entry field.

Right aligned

If the parameter is checked, text is right-aligned within the text entry field.

Multiline

The parameter allows to display and insert a multiline text.

Wordwrap

Automatically wraps a string typed into the text entry field after it reaches the right side of the field (the parameter Multiline must be also checked).

Font

Clicking the button placed right opens a list of text fonts. A font selected from the list will be used for the text entry field. For more information on text fonts see the topic Text fonts.


Note: Font can be modified (changed) from the picture script using the function %HI_SetFontStyle.

AutoComplete List


For Entry field, there is allowed to assign AutoComplete List (text prediction, list of words). User may choose a word from the list and insert it on the defined position in the Entry field. The items are defined on the application side, which enables their different utilization. The primary function of AutoComplete List is the possibility to add the words and insert them to the written text.
This feature is supported by ESL function %HI_ShowAutoCompleteList. OnTypeTextChange picture event enables showing the written text. OnAutoCompleteListSelected picture event enables showing the selected text.

Features:
  • Filling the list
  • Selection the item from list and insertion to Entry field (from the defined position).
  • Handling:
    • creating the list - %HI_ShowAutoCompleteList function,
    • moving in the list with up/down arrows,
    • selection from the list - with Enter key or left mouse double click,
    • cancelling the list - Esc key, right and left arrows, mouse clicking out of list.
  • The list appears from the given position _startPos which is defined by %HI_ShowAutoCompleteList.
Example:
Example of AutoComplete list
ENTRYX OnTypeTextChange(IN INT _refID, IN TEXT _Line, IN INT _StartPos, _CursorPos)
 
 INT _i
 INT _count
 INT _iDim
 
  TEXT _tPrefix
 TEXT _tDBwhere
 
 RECORD (SD.ARR_TEXT) _tRec
  RECORD (SD.DICTIONARY) _tRecDB
 
 IF 0 < %LenStr(_Line) THEN
  _tPrefix := %SubStr(_Line,_StartPos,_CursorPos - _StartPos)
  IF 0 < %LenStr(_tPrefix) THEN
   _tDBwhere := "NAME LIKE '" + _tPrefix +"%'"
   RECORD DB.DICTIONARY, _tRecDB, _retCode, 1000 WHERE _tDBwhere
 
    IF _retCode = 0 THEN
     _iDim := _tRecDB\DIM
 
     REDIM _tRec[_iDim]
 
     COPYCOL _tRecDB^NAME, _tRec^TEXT1
 
     SORT _tRec^TEXT1, @TRUE
 
     %HI_ShowAutoCompletionList(_refID,_tRec^TEXT1, _StartPos)
 
    ENDIF 
   ENDIF
  ENDIF 
 
 END OnTypeTextChange
Napíšte komentár