Xbasic

UI_GET_TEXT Function

Syntax

C UI_GET_TEXT(C title,C prompt[,C default_choice[,C format_string]])

Arguments

title

The title of the dialog box.

prompt

The descriptive text next to the text field.

default_choice

Optional. Default = "". A default value to display in the text field.

format_string

Optional. Default = "" (all characters). Forces the entered text to follow a specific format. The format string is a sequence of special characters that dictates how you are to enter a valid text string.

Format Character
Description
L

Any upper letter

|

Any letter

#

Any digit, sign, or decimal

N

Any upper letter, digit, sign or decimal

n

Any letter, digit, sign or decimal

A

Any upper letter or digit

a

Any letter or digit

0

Any digit

&

Any character

Description

UI_GET_TEXT() creates and displays a dialog box containing a text field. The text that you enter or change is returned as a Result_String. This function is useful for obtaining a text string that conforms to a specified format.

images/UI_GET_TEXT.GIF

The Result_String will be empty ("") if the Cancel button is selected.

Example

The dialog box presents a default choice of "Green" then prompts the user for a favorite color.

dim color as C
color = ""
color = ui_get_text("Favorite color","Enter your favorite color ", "Green", "&&&&&&&&&&&")
? color
= "Purple"

This example implements a "find by key" function using UI_GET_TEXT().

dim key as C
key = ui_get_text("Find", "Find what")
if (key <> "") then
    topparent.find(key)
end if

Limitations

Desktop applications only.

See Also