input$ = InKeyStr(type[, maxlen, password, cursor])
type
specifies the characters that are allowed to be typed in. maxlen
can be used to limit the maximum length of the user input (default is
0 which means no limit). If password
is set to True
, Hollywood will show
an asterisk (*) for every character typed in.
The following types can be specified currently:
#ALL
#ALPHABETICAL
#ALPHANUMERICAL
#HEXNUMERICAL
#NUMERICAL
If you have layers enabled while using this function, you will get
a new layer of type #PRINT
which contains the string the user has typed
in (since Hollywood 2.0; in previous versions, layers for each character
were added).
Starting with Hollywood 8.0, there is a new optional argument named cursor
.
If this is set to True
, InKeyStr()
will show a cursor while the user is
typing. In that case it is also possible to use the cursor keys to navigate
backwards and forwards and it is also possible to delete characters using
the DEL key. The cursor will be drawn in the same color as the text.
Hollywood 8.0 also adds paste support to InKeyStr()
. Just press CTRL+V
(on Windows) or CMD+V (on all other systems) to paste text from the clipboard
into the current insert position.
maxlen
characters; otherwise he can
input as many characters as he wants and finish his input
by pressing the RETURN key (defaults to 0 which means that
the user can input as many characters as he wants)True
, Hollywood will display an asterisk
(*) instead of the actual character typed in (defaults to False
)True
, a cursor indicating the current
insert and delete position will be shown (defaults to False
) (V8.0)Print("What is your name? ") name$ = InKeyStr(#ALPHABETICAL) Print("Hello", name$, "!")The code above asks the user to enter his name and then it will be output.