s$, ok = StringRequest(title$, body$[, def$, type, maxchars, password])
title$and the body text specified in
body$. Optionally, you can specify a default string that shall be displayed in the requester's string widget. If you do not specify
def$, the string widget will be empty. The optional argument type can be used to specify which characters the user is allowed to type in,
#NUMERICALare currently supported here. The optional argument maxchars can be used to limit the number of characters the user can type. This argument defaults to 0 which means that the user can type in as much as he wants. Last but not least there is the optional argument password, which can be set either to
False. If it is set to
True, the characters that the user types will not be visible.
The string that the user has entered will be returned by this function. 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.
Please note that this command requires reqtools.library to be installed
on AmigaOS 3, MorphOS, and AROS. Under AmigaOS 4 the
function works without reqtools.library.
Starting with Hollywood 6.0 you can pass an empty string ("") in the first parameter. In that case, the requester will use the title specified in the @APPTITLE preprocessor command.
#ALL(accept everything) and
#NUMERICAL(accepts numbers only) (defaults to
Trueif the characters shall not be visible or
Falseif they can be visible (defaults to
Trueif the user pressed the 'OK' button,
a$ = StringRequest("My Program", "Please enter your name!") Print("Hello,", a$, "!")Ask the user for his name and print it out.