LoginLogin
Might make SBS readonly: thread

PUSHKEY

Root / Documentation / [.]

Created:
Push text to the key buffer or send special control codes. This function is primarily used by the software keyboard (#SYS/SOFTKEY.PRG) and is intended for simulating keyboard input. The text will be entered to the focused text entry (INPUT, the editor etc.) or can be read using INKEY$. The key buffer has a maximum size of 128 characters.

Syntax

PUSHKEY text$
PUSHKEY charCode%
InputDescription
text$A string of text to push to the key buffer; max length 63 characters.
charCode%A character code to push to the buffer as text (0-65535). If the value is in the range 65536-69631, it is interpreted as a control code.

Examples

PUSHKEY "Hello"  'push "Hello" to the key buffer
PUSHKEY 65       'push the character "A" to the key buffer
PUSHKEY 65539    'move the text cursor right (control code)

Control Codes

If the charCode% parameter is from 65536 to 69631 it is interpreted as a control code. Control codes perform certain actions in the environment (usually related to the editor and key shortcuts.) They are not treated like normal key presses or text characters; they do not enter the key buffer and are processed immediately. It appears that SmileBASIC can only process one control code per frame. This feature is not officially documented.

Control Code Table

An ENUM of control codes is listed in #SYS/SOFTKEY.PRG, under the comment "KEYBOARD CONTROL CODES." This table has been duplicated here and translated for convenience. The Name column refers to the names of the ENUM constants and the Number column is the number of the control code, which is value of that constant; if you want to use the constants by name, you will have to copy the control code ENUM from #SYS/SOFTKEY.PRG and paste it in your program.
table
NameValueDescription
#CK_UP65536Move text cursor up
#CK_DOWN65537Move text cursor down
#CK_LEFT65538Move text cursor left
#CK_RIGHT65539Move text cursor right
#CK_BS65540Backspace key
#CK_DEL65541Delete key
#CK_PAGEUP65542Page Up key
#CK_PAGEDOWN65543Page Down key
#CK_TAB65544Tab key
#CK_LINETOP65545Go to beginning of line
#CK_LINEEND65546Go to end of line
#CK_LINEJUMP65547Open the "Go to line" prompt in the editor
#CK_FILETOP65548Go to top of file
#CK_FILEEND65549Go to end of file
#CK_INSLINE65550Insert blank line at cursor
#CK_DELLINE65551Delete line at cursor
#CK_DELRIGHT65552Delete text from the cursor to the end of the line
#CK_UNDO65553Editor undo
#CK_REDO65554Editor redo
#CK_SELECTSTART65555Start text selection
#CK_SELECTEND65556End text selection
#CK_COPY65557Copy selected text to clipboard
#CK_CUT65558Cut selected text to clipboard
#CK_PASTE65559Paste text from clipboard
#CK_SMARTDEL65560Smart Delete? "選択個所を削除 Delete selected location"
#CK_RUN65561Go to Direct mode
#CK_EDIT65562Go to editor (last used slot)
#CK_EDIT065563Go to editor (slot 0)
#CK_EDIT165564Go to editor (slot 1)
#CK_EDIT265565Go to editor (slot 2)
#CK_EDIT365566Go to editor (slot 3)
#CK_STOP65567Stop running program
#CK_EXIT65568Go to Top Menu
#CK_TOOL65569Run SmileTool 1
#CK_TOOL265570Run SmileTool 2
#CK_TOOL365571Run SmileTool 3
#CK_SYSREQ65572Run / stop program (SysReq key)
#CK_LOAD65573Open Simple Load menu
#CK_SAVE65574Open Simple Save menu
#CK_LISTERR65575Acts like LIST ERR
#CK_SOFTKEY65576Toggle the software keyboard/UI program display
#CK_ESCAPE65577Escape key
#CK_FONT65578Cycle editor font
#CK_WRAP65579Toggle editor line wrap
#CK_SPLIT65580Editor split screen (toggle? enable?)
#CK_SPLIT_SINGLE65581Disable editor split screen
#CK_SPLIT_VERTICAL65582Editor split screen (vertical)
#CK_SPLIT_HORIZONAL65583Editor split screen (horizontal)
#CK_TAB_INC65584Increase indent
#CK_TAB_DEC65585Decrease indent
#CK_COMMENTOUT65586Comment text
#CK_UNCOMMENTOUT65587Uncomment text
#CK_SCROLL_UP65588Scroll up without moving cursor
#CK_SCROLL_DOWN65589Scroll down without moving cursor
#CK_SCROLL_LEFT65590Scroll left without moving cursor
#CK_SCROLL_RIGHT65591Scroll right without moving cursor
#CK_SCROLL_PAGEUP65592Page up without moving cursor
#CK_SCROLL_PAGEDOWN65593Page down without moving cursor
#CK_HELP65594Toggle help menu
#CK_HELP_ON65595Open help menu
#CK_HELP_OFF65596Close help menu
#CK_HELP_PREVHEADER65597Go to previous header in help menu (unused)
#CK_HELP_NEXTHEADER65598Go to next header in help menu (unused)
#CK_HELP_COPY65599Copy code sample from help menu (unused)
#CK_HELP_UP65600Scroll help menu up (unused)
#CK_HELP_DOWN65601Scroll help menu down (unused)
#CK_HELP_UPD65602Help menu update? (unused)
#CK_FIND_REPL65603Toggle Find & Replace mode
#CK_FIND_REPLALL65604Replace all (unused)
#CK_FIND_REPLNEXT65605Replace next (unused)
#CK_FIND_REPLSWITCH65606Switch between Find and Replace entry
#CK_FIND_PREV65607Go to previous match
#CK_FIND_NEXT65608Go to next match
#CK_FINDMODE65609Toggle Find mode
#CK_FOCUS_NEXT65610Focus next (editor panel?)
#CK_FOCUS_PREV65611Focus previous (editor panel?)
#CK_FOCUS_MAIN65612Focus main program
#CK_FOCUS_SUB65613Focus subprogram
#CK_FUNC165614Paste F1 key string
#CK_FUNC265615Paste F2 key string
#CK_FUNC365616Paste F3 key string
#CK_FUNC465617Paste F4 key string
#CK_FUNC565618Paste F5 key string
#CK_INSERT65619Switch Insert / Overwrite mode
#CK_RESET65620IO Reset (Ctrl+Alt+Del)
#CK_SOFTKEY_ON65621Show software keyboard/UI program
#CK_SOFTKEY_OFF65622Hide software keyboard/UI program
#CK_TRACE65623Acts like TRACE
#CK_PERFGAUGE65624Toggle the performance gauge
#CK_SPLIT_GUIDE65625"Split screen for guide" (unused since 4.1)
#CK_COMPLETION_OFF65626Disable text completion popups (unused since 4.1)
#CK_SOFTKEY_RIGHT65627Show software keyboard on right side of screen
#CK_SOFTKEY_DOWN65628Show software keyboard on lower side of screen
#CK_SOFTKEY_LEFT65629Show software keyboard on left side of screen
#CK_SOFTKEY_UP65630Show software keyboard on upper side of screen
#CK_ERRJUMP65631Jump to error line in editor (different from LIST ERR?)
#CK_EDIT465632Go to editor (slot 4)
#CK_EDIT565633Go to editor (slot 5)

Unknown Constants

Some constants are commented out or marked "Not compatible?" in the code. The table below is speculative; these constants will not work.
NameDescription
#CK_CAPTUREMay have activated Switch screen capture
#CK_BACKTRACEActs like BACKTRACE?
#CK_CONTActs like CONT?

Notes

  • The documentation states the input string has a maximum length of 64 characters, but it is actually 63. This is likely a bug.
  • It is unknown if the rest of the control codes in the valid range do anything.
  • #CK_SPLIT_HORIZONAL is misspelled. It should be #CK_SPLIT_HORIZONTAL.

No posts yet (will you be the first?)