Post Reply 
CSTMENU: multilevel custom menu with soft keys
01-08-2021, 05:15 PM (This post was last modified: 11-28-2023 11:48 AM by ramon_ea1gth.)
Post: #1
CSTMENU: multilevel custom menu with soft keys
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:
{1,1}▶CSTpos
{{“A”,”B”,”ALOG()”,”α”,”β”,”1”,”2”,”3”}}▶CST
(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:
{{{“m”,”_(m)”},{“cm”,”_(cm)”},”Hello”,{“ALOG”,”ALOG()”}}}▶CST

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.:
{1,1}▶AVars(“CSTpos”)
{{“A”,”B”,”ALOG()”,”α”,”β”,”1”,”2”,”3”}}▶AVars("CST")

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!

[Edit]:
Changelog
v1.01:
Added #pragma header to support multi-language separators


Attached File(s) Thumbnail(s)
   

.hpprgm  CSTMENU.hpprgm (Size: 6.51 KB / Downloads: 18)

Ramón
Valladolid, Spain
TI-50, Casio fx-180P, HP48GX, HP50g, HP Prime G2
Visit this user's website Find all posts by this user
Quote this message in a reply
01-09-2021, 11:16 AM
Post: #2
RE: CSTMENU: multilevel custom menu with soft keys
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:
Code:
   IF TYPE(menuTMP(1))==2 AND TYPE(menuTMP(2)) THEN
    menuBAR(n):=menuTMP(1);
    menuCMD(n):=menuTMP(2);
   ELSE
    RETURN "Error in CST var format";
   END;

The correct writing is:
Code:
   IF TYPE(menuTMP(1))==2 AND TYPE(menuTMP(2))==2 THEN
    menuBAR(n):=menuTMP(1);
    menuCMD(n):=menuTMP(2);
   ELSE
    RETURN "Error in CST var format";
   END;

Ramón
Valladolid, Spain
TI-50, Casio fx-180P, HP48GX, HP50g, HP Prime G2
Visit this user's website Find all posts by this user
Quote this message in a reply
01-09-2021, 03:05 PM
Post: #3
RE: CSTMENU: multilevel custom menu with soft keys
Hi,

Thank for sharing.

KUDOS !

Gérard.
Find all posts by this user
Quote this message in a reply
01-09-2021, 08:43 PM
Post: #4
RE: CSTMENU: multilevel custom menu with soft keys
Great! Enjoy it!

Ramón
Valladolid, Spain
TI-50, Casio fx-180P, HP48GX, HP50g, HP Prime G2
Visit this user's website Find all posts by this user
Quote this message in a reply
01-31-2021, 09:42 AM
Post: #5
RE: CSTMENU: multilevel custom menu with soft keys
Bonjour

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.

Hello

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

Sorry for my english
Find all posts by this user
Quote this message in a reply
02-01-2021, 08:28 PM
Post: #6
RE: CSTMENU: multilevel custom menu with soft keys
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!
;-)

Ramón
Valladolid, Spain
TI-50, Casio fx-180P, HP48GX, HP50g, HP Prime G2
Visit this user's website Find all posts by this user
Quote this message in a reply
02-28-2021, 01:03 AM (This post was last modified: 02-28-2021 01:19 AM by CharlieF.)
Post: #7
RE: CSTMENU: multilevel custom menu with soft keys
GREAT!!! Masterly!!

Thank you very much, Ramón!!

All the best.

Carlos
Madrid, Spain
Casio ClassPad II, HP17BII, HP48GX, HP50g, HP Prime G2
Find all posts by this user
Quote this message in a reply
03-20-2021, 11:53 AM (This post was last modified: 03-20-2021 12:47 PM by FrankP.)
Post: #8
RE: CSTMENU: multilevel custom menu with soft keys
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:
Code:

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>"

   

.zip  CstMenu.zip (Size: 7.69 KB / Downloads: 39)

---------

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:
Code:

menuList :=
 { { "disp_text1",   "out_text1" },
   { "disp_text2",   "out_text2" },
   { "submenu1"  , { "menu1_disp_and_out1",
                     "menu1_disp_and_out2",
                     "menu1_disp_and_out3"
                   }
   },
   { "submenu2"  , { "menu2_disp_and_out1",
                     "menu2_disp_and_out2"
                   }
   }
 };


.zip  menu.zip (Size: 6.47 KB / Downloads: 31)
Find all posts by this user
Quote this message in a reply
04-08-2021, 09:09 PM
Post: #9
RE: CSTMENU: multilevel custom menu with soft keys
Great to see variations/improvements of CSTMENU! And of course, anyone can use it to create whatever kind of new program :-)

Ramón
Valladolid, Spain
TI-50, Casio fx-180P, HP48GX, HP50g, HP Prime G2
Visit this user's website Find all posts by this user
Quote this message in a reply
06-05-2022, 04:13 AM
Post: #10
RE: CSTMENU: multilevel custom menu with soft keys
This is a really cool approach to making use of the soft keys!

One question: I have used this successfully on my Prime G2 (hardware revision D), but I recently got a Prime G1 (hardware revision C) and tried it on that model, and I get really bad screen flicker on the menu "title" and on the bottom. Is this just a hardware limitation of the G1?

I need to try the "non title" version of the program yet from the OP, as I started out with the title version first...not sure if that makes a difference or not.

Thanks!
Find all posts by this user
Quote this message in a reply
06-05-2022, 07:57 AM (This post was last modified: 06-05-2022 08:14 AM by ramon_ea1gth.)
Post: #11
RE: CSTMENU: multilevel custom menu with soft keys
Great to hear the feedback!

About the 'non-title' versión, in the first/main post, I made it very simple with standard instructions, so it could be used in different environments, whether with app variables or global. This would allow to have a different soft menu per application, which can be interesting to organise the calculator contents.

Also, as the CSTMENU concept is very simple, it is possible to create programs that, for example, change the contents of CST depending on the choice of a choosebox. And units can be added easily if you need them.

Because of this simplicity, I would expect the 'non title' version to be very robust across firmware updates and platforms (G1, G2 and computer/phone apps). Even it is consistent with the calculator dark mode. Simplicity can be very powerful :-)

I'm sure FrankP can give more feedback about his very interesting 'title version'.

Ramón
Valladolid, Spain
TI-50, Casio fx-180P, HP48GX, HP50g, HP Prime G2
Visit this user's website Find all posts by this user
Quote this message in a reply
06-05-2022, 02:59 PM
Post: #12
RE: CSTMENU: multilevel custom menu with soft keys
(06-05-2022 07:57 AM)ramon_ea1gth Wrote:  Great to hear the feedback!

About the 'non-title' versión, in the first/main post, I made it very simple with standard instructions, so it could be used in different environments, whether with app variables or global. This would allow to have a different soft menu per application, which can be interesting to organise the calculator contents.

Also, as the CSTMENU concept is very simple, it is possible to create programs that, for example, change the contents of CST depending on the choice of a choosebox. And units can be added easily if you need them.

Because of this simplicity, I would expect the 'non title' version to be very robust across firmware updates and platforms (G1, G2 and computer/phone apps). Even it is consistent with the calculator dark mode. Simplicity can be very powerful :-)

I'm sure FrankP can give more feedback about his very interesting 'title version'.

I went back and switched to your original version (without the titles), and it still flickers the bottom softkey area of the screen. With the titled version, the flickering is much more pronounced in the title area.

I am linking a short youtube video showing the a side-by-side of the G1 (left) and the G2 (right) running the "titled" version to show the issue I see. I am curious if this is an issue with the G1 hardware (Rev C), or if it is just my newly aquired (used) device's issue.

https://youtu.be/mkH7uIbCtHU

Thanks!
Find all posts by this user
Quote this message in a reply
06-06-2022, 07:20 AM (This post was last modified: 06-06-2022 09:00 AM by FrankP.)
Post: #13
RE: CSTMENU: multilevel custom menu with soft keys
I guess different processing speed on the 2 HPs could result in flickering effect for DRAWMENU, TEXTOUT_P on one of them. You might reduce flickering of the title display by only updating tile text when a directional key pad action has occured. For example by encapsulating the TEXTOUT with IF:
Code:

 IF TYPE(w)<>6 THEN // no Mouse event
  IF w==7 OR w==8 OR w==2 OR w==12 THEN // directional pad
   // TEXTOUT_P(text, [G], x, y, [font], [textColor], [width], [backgroundColor]) returns text width
   TEXTOUT_P("                                                                                 ",G0,45,2,3,#FFFFFFh,200,#2F2F2Fh);
   TEXTOUT_P(menuTITLE,G0,130-TEXTOUT_P("A",G1,0,0)*DIM(menuTITLE)/2,2,3,#FFFFFFh,200,#2F2F2Fh);
   TEXTOUT_P("m."+CSTpos(1)+"/"+lmenu+" p."+CSTpos(2)+"/"+lpos,G0,185,8,1,#F0F0F0h,200,#2F2F2Fh);
  END;
 END;
Using Prime only on an outdated Android I can't do any tests. Good luck!
Find all posts by this user
Quote this message in a reply
06-06-2022, 11:11 AM
Post: #14
RE: CSTMENU: multilevel custom menu with soft keys
A fast and simple test in the G1 can be done by writing this in the home screen:
Code:
DRAWMENU("TEST1","TEST2","TEST3","TEST4","TEST5","TEST6"); WAIT(-1)
This is the simplest form of DRAWMENU, used for creating the soft keys in CSTMENU. If flicker is still noticeable, then it is a matter of the processing speed of the calculator, as FrankP said.

Ramón
Valladolid, Spain
TI-50, Casio fx-180P, HP48GX, HP50g, HP Prime G2
Visit this user's website Find all posts by this user
Quote this message in a reply
06-06-2022, 12:27 PM
Post: #15
RE: CSTMENU: multilevel custom menu with soft keys
(06-06-2022 11:11 AM)ramon_ea1gth Wrote:  A fast and simple test in the G1 can be done by writing this in the home screen:
Code:
DRAWMENU("TEST1","TEST2","TEST3","TEST4","TEST5","TEST6"); WAIT(-1)
This is the simplest form of DRAWMENU, used for creating the soft keys in CSTMENU. If flicker is still noticeable, then it is a matter of the processing speed of the calculator, as FrankP said.

I tried the above on my G1, but it only displayed for a brief second (not sure why, but with the negative one argument to wait, it terminates almost instantly with no input from me)...

So I tried the above and changed it to say wait(6), and it displayed longer, and didn't appear to flicker at all.

Not sure what this indicates, though...
Find all posts by this user
Quote this message in a reply
06-06-2022, 12:40 PM (This post was last modified: 06-06-2022 01:00 PM by ramon_ea1gth.)
Post: #16
RE: CSTMENU: multilevel custom menu with soft keys
Interesting. This means that WAIT(-1) is not working in your G1 by some reason and this causes the flicker, as the program is looping continuously through the non-working WAIT.
Is your G1 updated? What is the firmware version? You can see it with the Help button, Tree, About HP Prime.

[Edit]
One more question: despite the flicker, is CSTMENU (whatever version) giving the expected output when you press the softkey? If yes, this would mean that a touching event is being detected continuously, even when not touching the screen (thus flickering). If so, the reasons of the false touching event could be a software problem (firmware issue) or a hardware malfunction.

Ramón
Valladolid, Spain
TI-50, Casio fx-180P, HP48GX, HP50g, HP Prime G2
Visit this user's website Find all posts by this user
Quote this message in a reply
06-06-2022, 01:10 PM
Post: #17
RE: CSTMENU: multilevel custom menu with soft keys
(06-06-2022 12:40 PM)ramon_ea1gth Wrote:  Interesting. This means that WAIT(-1) is not working in your G1 by some reason and this causes the flicker, as the program is looping continuously through the non-working WAIT.
Is your G1 updated? What is the firmware version? You can see it with the Help button, Tree, About HP Prime.

[Edit]
One more question: despite the flicker, is CSTMENU (whatever version) giving the expected output when you press the softkey? If yes, this would mean that a touching event is being detected continuously, even when not touching the screen (thus flickering). If so, the reasons of the false touching event could be a software problem (firmware issue) or a hardware malfunction.

The cstmenu works fine other than the flicker. About screen shows:
Software: 2.1.14603 (2021 12 02)
HW Ver: C
CAS Ver: 1.5.0

OS: V0.050.640

The only thing that comes to mind is that I have newRPL installed. This can be booted by pressing On-Symb, and then Esc immediately after that. I will revert fully to stock FW and see if that changes anything.

So based on what you said, if I enter:
WAIT(-1) (all by itself on home screen)
I should see the calc just sit there waiting for user input? I tried that too, and it immediately returns -1.

Thanks!
Find all posts by this user
Quote this message in a reply
06-06-2022, 01:25 PM
Post: #18
RE: CSTMENU: multilevel custom menu with soft keys
OK, I'm afraid it's a firmware issue in G1, related to the 2021 version and WAIT(-1). It has to be fixed:
https://www.hpmuseum.org/forum/thread-17294.html

Ramón
Valladolid, Spain
TI-50, Casio fx-180P, HP48GX, HP50g, HP Prime G2
Visit this user's website Find all posts by this user
Quote this message in a reply
06-06-2022, 01:28 PM
Post: #19
RE: CSTMENU: multilevel custom menu with soft keys
(06-06-2022 01:25 PM)ramon_ea1gth Wrote:  OK, I'm afraid it's a firmware issue in G1, related to the 2021 version and WAIT(-1). It has to be fixed:
https://www.hpmuseum.org/forum/thread-17294.html

Ah - good. At least my new(to me) G1 calc isn't defective. I was going to pop back and say that reverting to the official firmware didn't help...and that the wait(-1) command on my G2 works as expected.
Find all posts by this user
Quote this message in a reply
06-06-2022, 01:54 PM
Post: #20
RE: CSTMENU: multilevel custom menu with soft keys
I downgraded to the (2020 01 16) version and it now works as expected. No flickering!

Thanks for your help!
Find all posts by this user
Quote this message in a reply
Post Reply 




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