Skip to content

CreateTextField

Claude edited this page Oct 26, 2026 · 5 revisions

CreateTextField

Command Index · BlitzPlus · Text Areas

CreateTextField x%, y%, width%, height%, group%, style%=0  ; returns Int

Works in: BlitzPlus

Makes a box for a single line of text. A $401 event is sent for each change and its EventData is the character typed, and Enter sends one with 13. Style 1 shows stars instead of what is typed, for passwords. Read the text with TextFieldText and set it with SetGadgetText.

Text fields use Enter and Escape themselves, so use a button of style 4 or 5 to react to these keys, see CreateButton.

Graphics 320, 240, 32, 2
win  = CreateWindow("Login", 10, 10, 300, 140, Desktop(), 3)
CreateLabel "Password:", 10, 10, 150, 24, win
pass = CreateTextField(10, 40, 200, 24, win, 1)
Repeat
	e = WaitEvent()
	If e = $401 Then SetGadgetText win, "Length " + Len(TextFieldText(pass))
Until e = $803

CreateTextField

Parameter Type Default Description
x Int required Horizontal position inside the group.
y Int required Vertical position inside the group.
width Int required Width of the field.
height Int required Height of the field.
group Int required Window, panel, tabber or canvas that holds it.
style Int 0 1 for a password field, plus 65536 for not following the group. Defaults to 0.

Returns: A handle for the text field.

Related commands

Command Index · BlitzPlus · Text Areas

Home · Command Index


Getting started

Language

Tools


Language Features
BlitzBasic
Blitz3D
BlitzPlus
Differences

Clone this wiki locally