Reference Manual

  • 15.0
  • 07/23/2021
  • Public Content
Contents

Using Edit Boxes

An Edit box is an area that your application can write text to at anytime. However, unlike Static Text, the user can write to an Edit box by clicking the mouse in the box and typing. The following statements write to an Edit box:
CHARACTER(20) text /"Send text"/ retlog = DLGSET (dlg, IDC_EDITBOX1, text)
The next statement reads the character string in an Edit box:
retlog = DLGGET (dlg, IDC_EDITBOX1, text)
The values a user enters into the Edit box are always retrieved as character strings, and your application needs to interpret these strings as the data they represent. For example, numbers entered by the user are interpreted by your application as character strings. Likewise, numbers you write to the Edit box are sent as character strings. You can convert between numbers and strings by using internal read and write statements to make type conversions.
To read a number in the Edit box, retrieve it as a character string with
DLGGET
or
DLGGETCHAR
, and then execute an internal read using a variable of the numeric type you want (such as integer or real). For example:
REAL x LOGICAL retlog CHARACTER(256) text retlog = DLGGET (dlg, IDC_EDITBOX1, text) READ (text, *) x
In this example, the real variable x is assigned the value that was entered into the Edit box, including any decimal fraction.
Complex and double complex values are read the same way, except that your application must separate the Edit box character string into the real part and imaginary part. You can do this with two separate Edit boxes, one for the real and one for the imaginary part, or by requiring the user to enter a separator between the two parts and parsing the string for the separator before converting. If the separator is a comma (,) you can read the string with two real edit descriptors without having to parse the string.
To write numbers to an Edit box, do an internal write to a string, then send the string to the Edit box with
DLGSET
. For example:
INTEGER j LOGICAL retlog CHARACTER(256) text WRITE (text,'(I4)') j retlog = DLGSET (dlg, IDC_EDITBOX1, text)
Use the DLG_TEXTLENGTH control index to get or set the length of the characters in the edit box. The length is automatically updated when:
  • Your program calls
    DLGSET
    to set the text in the edit box (trailing blanks are stripped before setting the edit box).
  • The user modifies the text in the edit box.
If you want to set the text with significant trailing blanks, call
DLGSET
to set the text followed by DLGSET with the DLG_TEXTLENGTH index to set the length that you want.
Use the DLG_POSITION index to get or set the current cursor position in the edit box. Note that setting the cursor position cancels any current selection in the edit box.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.