!******************************************************************************!
! Tests the keyboard short cuts for SHELLGUI.
!
! Author:  Neon Ngo
!******************************************************************************!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE

  if interAct then
    pipe on
      panel/msgid=MAIN/setup/controls=gc
      gcontrol label macro "MACRO"
      gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
      set gc.main.itemColors {PASS=GREEN,FAIL=RED}

      set instructions "In the SHELLGUI terminal on the right,\n&
            test the keyboard shortcuts (hotkeys):\n  &
            Backspace   = delete one character to left of cursor\n  &
            Delete      = delete one character to right of cursor\n  &
            Ctrl-A      = Move to beginning of line (since 3.0.0)\n  &
            Ctrl-C      = Copy Selected Text\n  &
            Ctrl-D      = Interrupt (i.e. break any running macro and exit)\n  &
            Ctrl-E      = Move to end of line\n  &
            Ctrl-H      = Move to beginning of line\n  &
            Ctrl-U      = Clear current input line\n  &
            Ctrl-V      = Paste text from system clipboard\n  &
            Down arrow  = Recall next command in history\n  &
            Left arrow  = Move one space to left\n  &
            Right arrow = Move one space to right\n  &
            Up arrow    = Recall previous command in history\n  &
            Home        = Move to beginning of line (since 3.0.0)\n  &
            End         = Move to end of line (since 3.0.0)\n  &
          "
      gcontrol text idtext  "Instructions" "^instructions" 24 18 /title

      shellgui/id=idshellgui
    pipe off
  endif

endmacro

!******************************************************************************!
! process messages for interactive tests
!******************************************************************************!
procedure processMessage m:msg
  if msg.name eqs "MAIN" then
    assert/text="^reg.main.name: User indicated tests" msg.data eqss "PASS"
    pipe stop

  else
    say "^reg.main.name: Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return
