HP Forums

Full Version: CSTMENU: multilevel custom menu with soft keys
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Feel the power of the customized soft keys of the HP Prime. CSTMENU is a compact and elegant program that allows the customization of the soft keys in a consistent manner, whether for the global environment or for each Prime app. Now it is possible to have at any entry window your preferred characters or commands, e.g., Greek characters for scientific writing, preferred units for fast unit conversion or fast access commands with customized entry. Menus are swiftly managed with the four ways of the directional pad (left/right/up/down).

Example of creation of a simple custom menu:
+ Download CSTMENU.hpprgm to the HP Prime
+ Create the two required variables, CSTpos and CST with your custom menu:
(notice the double curly brackets {{ in CST)
+ Switch to User mode: [SHIFT][USER][SHIFT][USER]

Now, your menu is ready. Press the Menu key. Use the directional pad (left/right) to navigate the menu. Press the desired softkey to output it. Each time you press the Menu key, you return to the last menu used.

Multiple menu levels:
CST can include multiple menu levels, e.g., for two levels: {{“1”,”2”,”3”,”4”,”5”,”6”,”7”,”8”}{“A”,”B”,”C”,”D”}}▶CST
To navigate the levels, use the up/down arrows of the directional pad.

Soft key labels different to the output:
CST can include pairs of {“label”,“output_text”} to create a different output than the soft key label, e.g., for fast unit conversion with the [STO>] soft key you can prepare this menu:

A custom menu per app:
CSTMENU is very flexible, so you can prepare one customized menu per app if you use app variables, e.g.:

And for you, the programmers, you can feel the flexibility of CSTMENU, so other programs can take advantage of it. Play with it to discover its power and have a customized HP Prime!
I just detected a small typo in the first version posted last January 8th, but with negligible impact. It is an input syntax check. However, the program has been updated in the main first post.
For those curious, the typo was in line 28. Originally it was written:
   IF TYPE(menuTMP(1))==2 AND TYPE(menuTMP(2)) THEN
    RETURN "Error in CST var format";

The correct writing is:
   IF TYPE(menuTMP(1))==2 AND TYPE(menuTMP(2))==2 THEN
    RETURN "Error in CST var format";

Thank for sharing.

Great! Enjoy it!

Je viens d'essayer ce programme rapidement, il me semble très
pratique et je trouve que c'est une excellente idée.
je vais tester plus sérieusement, merci pour ce programme.


I have just tried this program quickly, it seems to me very
practical and I think it's a great idea.
I will test more seriously, thank you for this program
Merci! J'espère que ça vous plait. C'est une application très simple mais très puissante!

Thank you! I hope you like it. It is a very simple but very powerful application!
GREAT!!! Masterly!!

Thank you very much, Ramón!!

All the best.
Hi Ramon,
your really smart CST solution was for me missing a kind of title for sub menus. So I added a title to your CST syntax:

CST :=
 { { "menu1_title", {   "menu1_displ_and_out1"          ,
                        "menu1_displ_and_out2"          ,
                        ""                              ,
                      { "menu1_displ3" , "menu1_out3" } ,
                      { "menu1_displ4" , "menu1_out4" }
   } ,
   { "menu2_title", {   "menu2_displ_and_out1"          ,
                      { "menu2_displ2" , "menu2_out2" } ,
In addition I added information on the actual menu and page to the displayed title:
"m.<act_menu_num>/<all_menus_in_CST> p.<act_page_num>/<all_pages_in_act_menu>"



For another approach (needing even some lines of code less) refer to the following program 'menu'.
It makes use of a choice popup dialog for CST menu display. For longer texts to display a bit more beautiful, I think. Unfortunately <left> and <right> directional pad keys are not supported (failed hooking into choice command, only supporting <up> and <down>).
Menu list syntax in this prog expects each entry on the main menu have a seperate display and output text, whereas entries in submenus are always display and output the same string:

menuList :=
 { { "disp_text1",   "out_text1" },
   { "disp_text2",   "out_text2" },
   { "submenu1"  , { "menu1_disp_and_out1",
   { "submenu2"  , { "menu2_disp_and_out1",

Great to see variations/improvements of CSTMENU! And of course, anyone can use it to create whatever kind of new program :-)
Reference URL's