FutureBasic Logo

<<    Index    >> FutureBasic

inkey   statement / function



Syntax
[key =] inkey [%(x,y) [,] ] [prompt]

Requires
macOS 10.12+

Description
On execution, a small floating panel appears which accepts a user keypress. Pressing any key returns a CFString containing the key's text.
The default location for the panel is 20 pixels in from the left and vertically centered on the app's front window. If there are no app windows, the panel is centered on the screen.

The prompt and (x,y) coordinate parameters are optional.

Parameters
Parameter Description
%(x,y) When this optional parameter is used, the inkey panel is positioned at point x,y relative to the top-left corner of the app's front window content area (or screen if the app does not have any open windows). If this parameter isn't specified, the inkey panel is displayed in its default location.
prompt A CFString-based message, supplied by the programmer's code, guides the user's key entry. It appears adjacent and immediately to the left of a flashing underscore.
 
Return value
A CFStringRef containing the user-entered text. If the inkey panel was dismissed with the 'esc' key, it returns NULL.

See also
The CocoaUI header, Inkey.incl, for a list of auxiliary functions such as InkeySetFormat.