Trident Help

Programming

Menus and key presses: Menu( and getKey

Let the user pick from a menu with Menu( and Lbl, or react to single key presses with a getKey loop.

Open in Trident

Menu( shows a title and up to nine choices. Each choice names a label; picking it jumps to the matching Lbl line in the program. Stop ends the program so it does not run into the next label.

getKey gives the code of the last key pressed, or 0 if none was pressed. A Repeat loop that keeps reading getKey waits for a key. Codes are row and column: the 5 key is 83 (row 8, column 3), ENTER is 105.

Classic Graphing 84 · A two-choice menu

Start on the main screen: Press 2nd then mode (QUIT) to get back to the home screen. Pressing clear on a menu also backs out of it.

  1. Create a program called PICK: PRGM, left arrow, 1, then P, I, C, K (8, x², PRGM, ( ) and ENTER.

    prgm◀18x²prgm(enter
  2. Paste Menu( from PRGM: it is item C of CTL, so press ALPHA, PRGM.

    prgmalphaCprgm
  3. Type the title "PICK", a comma, the first choice "ONE", a comma and its label A. Lock letters for each word and unlock before the commas.

    2ndA-LOCKalpha+8x²prgm(+alphaJ,2ndA-LOCKalpha+7logsin+alphaJ,alphaAmath
  4. Add the second choice "TWO" with label B, close the bracket and press ENTER.

    ,2ndA-LOCKalpha+4−7+alphaJ,alphaBapps)enter
  5. Lbl A (PRGM, 9, then A), Disp "ONE", and Stop (PRGM, ALPHA, COS for item F).

    prgm9alphaAmathenterprgm▶32ndA-LOCKalpha+7logsin+alphaSOLVEenterprgmalphaFcosenter
  6. Lbl B and Disp "TWO".

    prgm9alphaBappsenterprgm▶32ndA-LOCKalpha+4−7+alpha
  7. Quit and run it. The menu PICK appears; press 2 to choose TWO.

    2ndQUITmodeprgm1enter2

You should seeThe program jumps to Lbl B and shows TWO.

Use the arrow keys and ENTER to pick a choice, or press its number.

Classic Graphing 84 key reference · Classic Graphing 84 manual

Classic Graphing 84 · A getKey loop

Start on the main screen: Press 2nd then mode (QUIT) to get back to the home screen. Pressing clear on a menu also backs out of it.

  1. Create a program called KEY: PRGM, left arrow, 1, then K, E, Y (the (, SIN and 1 keys) and ENTER.

    prgm◀1(sin1enter
  2. Line 1, 0→K, so the loop starts with no key.

    0sto→alphaK(enter
  3. Line 2, Repeat K: PRGM, 6, then K. The loop repeats until K is not 0.

    prgm6alphaK(enter
  4. Line 3, getKey→K: PRGM, right arrow, 6 (getKey), STO→, K.

    prgm▶6sto→alphaK(enter
  5. Line 4, End, and line 5, Disp K.

    prgm7enterprgm▶3alphaK(
  6. Quit and run it. The busy marker shows while it waits; press the 5 key.

    2ndQUITmodeprgm1enter5

You should seeThe key code of 5, 83, is shown.

Press ON to break out of a loop that never ends.

Classic Graphing 84 key reference · Classic Graphing 84 manual

Tips

Related guides