s$, ok = StringRequest(title$, body$[, t])
s$, ok = StringRequest(title$, body$[, def$, type, maxchars, password])
title$
and the body
text in body$
. If you pass an empty string ("") title$
, the requester will
use the title specified in the @APPTITLE preprocessor
command.
StringRequest()
will return the string the user has entered if the user acknowledges
the requester. If the user cancels this requester, an empty string will be returned.
The second return value allows you identify whether or not the user pressed the 'OK'
button. This is normally only needed if your application allows an empty string on 'OK'.
In that case you need to check the second return value, too.
StringRequest()
supports many optional arguments. Before Hollywood 9.0, those
had to be passed as optional parameters (see above). Since Hollywood 9.0,
however, it is recommended to use the new syntax, which has a single optional
table argument that can be used to pass one or more optional arguments to
StringRequest()
.
The following table fields are recognized by this function:
Type:
#NUMERICAL
for numbers only or #ALL
for
no restriction on characters that can be entered. Defaults to #ALL
.
Password:
True
to put the requester in password mode. In
that case, the user's input will be hidden. Defaults to False
.
MaxLength:
Text:
X:
Y:
Width:
Height:
Please note that this command requires reqtools.library to be installed
on AmigaOS 3, MorphOS, and AROS. Under AmigaOS 4 the StringRequest()
function works without reqtools.library.
True
if the user pressed the 'OK' button, False
otherwise (V4.5)a$ = StringRequest("My Program", "Please enter your name!") Print("Hello,", a$, "!")Ask the user for his name and print it out.