HP Forums
Choose Funktion in an Choose Funktion - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Choose Funktion in an Choose Funktion (/thread-3875.html)



Choose Funktion in an Choose Funktion - Heino - 05-17-2015 02:08 PM

Hello all,

How can i create an choose function i a choose function?


RE: Choose Funktion in an Choose Funktion - Spybot - 05-17-2015 04:00 PM

Hello Heino!

Did you mean something like this?



EXPORT Prog()
BEGIN
LOCAL VARIABLE_01,VARIABLE_02;
CHOOSE(VARIABLE_01,"TITLE",{"OPTION_01","OPTION_02","OPTION_03"});
CASE
IF VARIABLE_01==1 THEN MSGBOX("COMANDS_01") END;
IF VARIABLE_01==2 THEN MSGBOX("COMANDS_02") END;
IF VARIABLE_01==3 THEN CHOOSE(VARIABLE_02,"TITLE",{"OPTION_04","OPTION_05","OPTION_06"});
CASE
IF VARIABLE_02==1 THEN MSGBOX("COMANDS_04") END;
IF VARIABLE_02==2 THEN MSGBOX("COMANDS_05") END;
IF VARIABLE_02==3 THEN MSGBOX("COMANDS_06") END;
DEFAULT
END;
END;
DEFAULT
END;
END;


RE: Choose Funktion in an Choose Funktion - Heino - 05-17-2015 05:59 PM

Hello Spybot,

thanks for your answer. That´s a good solution, but I search for another one.
See Screen1.


RE: Choose Funktion in an Choose Funktion - petaks01 - 05-17-2015 07:10 PM

Where did you get the screenshot from?
I guess the code behind it has some hints...


RE: Choose Funktion in an Choose Funktion - kharpster - 05-17-2015 07:26 PM

(05-17-2015 07:10 PM)petaks01 Wrote:  Where did you get the screenshot from?
I guess the code behind it has some hints...

That looks like a system menu/sub menu and not a choose command. In so far I can tell we do not yet have the ability to create submenus in our programs.


RE: Choose Funktion in an Choose Funktion - Heino - 05-17-2015 07:47 PM

Okay, you are right. But I have made my solution with Spybot's program.

Thank's all.

Heino


RE: Choose Funktion in an Choose Funktion - John Colvin - 05-17-2015 07:54 PM

(05-17-2015 07:26 PM)kharpster Wrote:  
(05-17-2015 07:10 PM)petaks01 Wrote:  Where did you get the screenshot from?
I guess the code behind it has some hints...

That looks like a system menu/sub menu and not a choose command. In so far I can tell we do not yet have the ability to create submenus in our programs.

Sub menus can be created, but not in the cascaded style in the screenshot. I created a custom choose box popup menu with sub menus where the sub menu replaces the parent menu on the screen. I use it to consolidate some of my most used programs.
That isn't the cascaded style but probably the next best thing.

------------------------------------------------------------
lastunit:={0,0};

KEY K_Space()
BEGIN
local list1:={"Electrical Eng",
"Geometry","Deg2Rad",
"Rad2Deg",
"atan2","DTAG",
"Slope"};
local list2:={{"Parallel_Resistance",
"Coulomb","in"},
{"Area_circle",
"Vol_sphere",
"Area_cyl"}};
local c1,c2;
if lastunit(1) OR lastunit(2) then
c1:=lastunit(1); c2:=lastunit(2);
choose(c2,list1(c1),list2(c1));
else
c1:=0; c2:=0;
end;

if c2==0 then
repeat
choose(c1,"User Functions",list1);
if c1<3 then
choose(c2,list1(c1),list2(c1));
else

RETURN list1(c1);
end;
until c1==0 OR c2;
lastunit:={c1,c2};
end;

if c2 then
return(list2(c1,c2));
end;
END;
----------------------------------------------------------
This program is based on example that I believe Han posted a while back to a similar question that I had about nested popup menus.