  #compact
  % filename "t.exe"
 'uses RTL64
  % Title "Console Demo (F1 help)"
 '% Animated
  % ScaleUp
 '% PlaceCentral
 '% AnchorCentral
 '% NoEscape

  $ filename "t.exe"
 'uses RTL64
  uses ConsoleG

  ! DescribeCraftParts()
  ! RenderCraft()

  procedure main()
  ================
  sys i,p
  string s
  float  a
  cls 0,0,0
  scale 2.,1.25
  printl "Select"
  scale .5,.80
  for i=1 to 10
    PickLabel i
    PushState
      color .99,.00,.00
      print i
    PopState
    PushState
    move 4 'tab
    print chr(i+64)
    PopState
    PushState
    move 8 'tab
    print hex(i+64,2)+"h"
    PopState
    move 0,-1 'linefeed
    PushState
      if picked=i 'mouse picker
        a=1.0
      else
        a=0.2
      end if
      Color .10,.10,.70, a
      move -0.5,0.9,-0.001
      PutBoxArea 12,1
    PopState
    PickLabel 0
  next
  '
  'TAB
  '
  if lastkey=9
    if picked
      picked=0 'allow text input
    else
      picked=1 'top of menu table
    end if
    lastkey=0
    lastchar=0
  end if
  '
  'MENU SELECTION USING KEYS
  '
  if picked>=1 and picked<=10
    SelectWithKeys p,1,10
    lastchar=0 : lastkey=0 'no further action
  end if
  '
  'SHOW SELECTION
  '
printl
  if picked>0 and picked<=10
    color .4,.4,.4
    printl "identity: " picked
  else
    printl
  end if
  printl
  '
  'LINE INPUT
  '
  PushState
  color .20,.80,.00,.88
  Scale 2
  print "Enter: "
  color .80,.80,.00,.88
  a=input inputs
  lastchar=0
  if a
    inputs="" : cp=1
  end if
  PopState
  printl
  '
  '
  'F1 HELP
  '
  if key[0x70]
    pushstate
    move 16,16
    color .8,.5
    scale  1.5,1.0
    printl "Active Keys:"
    scale  1/1.5,1.0
    printl "Tab"
    printl "Space"
    printl "Up"
    printl "Down"
    printl "Home"
    printl "End"
   'printl "Enter"
    printl "Esc"    tab "Exit"
    printl "Ctrl-P" tab "Take snapshot"
    printl
    scale 1.5,1.0
    printl "Mouse:"
    scale 1/1.5,1.0
    printl "Click to Select"
    popstate
  end if
  '
  lastkey=0
  lastchar=0
  '
  end procedure

  EndScript
