Post Reply 
HP42S VARMENU within MENU Exit button challenge
02-20-2018, 04:01 AM
Post: #1
HP42S VARMENU within MENU Exit button challenge
I'm trying to bring up a VARMENU from a main MENU such that exiting the variable menu via the Exit button takes me back to the main menu. I don't want the Exit key to stop the program and leave me stranded without a menu.

The standard technique for nested menus e.g. p37 of the HP42S advanced programming manual says to assign a "jump to the main menu label" in your submenu using the command "KEY 9 GTO ..." (the '9' key is the Exit key). This works with normal sub (menus) but not with varmenus it seems. e.g. line 11 has no effect.

Code:

00 { 100-Byte Prgm }
01▸LBL "nestvar"
02 CLMENU
03 "subm"
04 KEY 1 XEQ "varmen"
05 MENU
06 STOP
07 GTO "nestvar"
08▸LBL "varmen"
09 MVAR "length"
10 MVAR "width"
11 KEY 9 GTO "nestvar"
12 VARMENU "varmen"
13 STOP
14 RCL "length"
15 RCL "width"
16 ×
17 RTN
18 END

Can anyone think of a way of achieving the desired effect? I.e. When looking at the varmenu, I want Exit to take me to the main menu.
Find all posts by this user
Quote this message in a reply
02-20-2018, 11:00 AM
Post: #2
RE: HP42S VARMENU within MENU Exit button challenge
That's not possible. The only menu that lets you customize the behavior of EXIT is the "programmable menu," i.e. the one you define with KEY GTO and KEY XEQ and activate with MENU. In all other menus, EXIT takes you to the next higher menu (like, say, going back to the main STAT menu from the CFIT submenu), or from the current regular menu to the current application menu.

(Application menus are SOLVER, ∫f(x), MATRIX, STAT, BASE, and VARMENU; these menus have the property that they stay active even when you select another (non-application) menu, so you'll return to them when you EXIT that other menu.)
Visit this user's website Find all posts by this user
Quote this message in a reply
02-20-2018, 11:16 AM
Post: #3
RE: HP42S VARMENU within MENU Exit button challenge
(02-20-2018 04:01 AM)tcab Wrote:  
Code:

[...]
17 RTN
18 END

Off-topic, pet peeve: this is never necessary. END doesn't just mark the end of a program; it is also an instruction, which does exactly the same thing as RTN. So, a subroutine can end with END, and putting RTN before END is redundant.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)