Name
InKeyStr -- query user input (V1.5)
Synopsis
input$ = InKeyStr(type[, maxlen, password, cursor])
Function
This function allows you to easily read input from the user's keyboard. 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
Will accept all visible characters

#ALPHABETICAL
Will accept only alphabetical characters; this is not necessarily limited to characters a-z. The user may also type special alphabetical characters that are only available in his language's alphabet

#ALPHANUMERICAL
Will accept alphabetical and numerical characters

#HEXNUMERICAL
Will accept hexadecimal characters (0-9 and a-f)

#NUMERICAL
Will accept 0-9

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.

Inputs
type
specifies which characters the user is allowed to type in
maxlen
optional: if you specify this argument, the user will only be able to type in 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)
password
optional: if set to True, Hollywood will display an asterisk (*) instead of the actual character typed in (defaults to False)
cursor
optional: if set to True, a cursor indicating the current insert and delete position will be shown (defaults to False) (V8.0)
Results
input$
the string that was typed in
Example
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.

Show TOC