EditText Control

Purpose

Creates an edit field control for user input.

Syntax

EditText text$, ID%, x%, y%, w%, h%[,style%]

Description

An EditText element is a rectangular area inside which text can be entered and edited (using Backspace and Delete). Clicking on an EditText element displays a text cursor within the rectangle. EditText can contain the WS_TABSTOP, WS_GROUP, WS_VSCROLL, WS_HSCROLL and WS_DISABLED style elements.

Other styles:

EDITES_LEFT ($0000) sets the text left justified in the edit field
ES_CENTER ($0001) centers the text within a multi-line edit field.
ES_RIGHT ($0002) sets the text right justified within a multi-line edit field.
ES_MULTILINE ($0004) defines a multi-line edit field.
ES_UPPERCASE ($0008) converts all characters in the IBM US character set to uppercase.
ES_LOWERCASE ($0010) converts all characters in the IBM US character set to lowercase.
ES_PASSWORD ($0020) displays all entered characters as asterisk.
ES_AUTOVSCROLL ($0040) scrolls the text one page up when the user presses the Return key on the last line.
ES_AUTOHSCROLL ($0080) when further characters are entered at the end of the line, scrolls the text ten characters to the left. Pressing the Return key sets the text back to position zero.
ES_NOHIDESEL ($0100) makes the selected entry in an edit field permanently visible.
ES_OEMCONVERT ($0400) converts characters from ANSI into OEM and back (for example using your own character table).

Example

Dlg 3D On

Global style%, style2%, file$

Dlg Base Unit

style% = WS_BORDER | WS_TABSTOP

style2% = BS_DEFPUSHBUTTON | WS_TABSTOP

Dialog # 1, 10, 10, 150, 100, "Test-Dialog"

EditText "", 101, 50, 10, 80, 14, style%

PushButton "OK", IDOK, 10, 60, 40, 14, style2%

PushButton "CANCEL", IDCANCEL, 80, 60, 40, 14, style2%

EndDialog

ShowDialog # 1

// to fill the edit field

file$ = "GFA-User"

_Win$(Dlg(1, 101)) = file$

Do

Sleep

Until Me Is Nothing

 

Sub Dlg_1_Message(hWnd%, Mess%, wParam%, lParam%)

Select Mess

Case WM_COMMAND

Select wParam

Case IDOK

file$ = _Win$(Dlg(1, 101))

CloseDialog # 1

OpenW 1

Print file$ : Print

Print "End with Alt + F4"

EndSelect

EndSelect

EndSub

Remarks

You can only type text into the edit field if it has the focus. The text can be read by using the _Win$() function and set by using _Win$()=.

This command is particular useful for a dialog box in a GLL, because a GLL doesn't support OCX controls.

With the general Control statement any control type can be created.

See Also

Control, AnimateCtrl, AutoCheckBox, AutoRadioButton, CheckBox, ComboBox, CText, Dialog, DefPushButton, EditText, GroupBox, HeaderCtrl, ListBox, ListViewCtrl, LText, ProgressCtrl, PushButton, RadioButton, RichEditCtrl, RText, ScrollBar, StatusCtrl, TabCtrl, ToolBarCtrl, TrackBarCtrl, TreeViewCtrl, UpDownCtrl

{Created by Sjouke Hamstra; Last updated: 03/10/2014 by James Gaite}