Post Reply 
Question about CAS and Graphing
11-26-2014, 10:15 AM (This post was last modified: 11-26-2014 10:56 AM by Angus.)
Post: #31
RE: Question about CAS and Graphing
hello CR Haeger,

on http://forum.hp-prime.de/discussion/94/u...ift#Item_8 (forum in german) we came up with the idea of improving the usability of the user keyboard.
Based on that I added a rudimentary softmenu that can be triggered with the view key prior an other key.

I added your functions to view+D for quick access without wasting many user keys. Maybe that concept can be helpful for you, too.
Keep us informed on your activities! I really like your blog. In a way it is didactically better that HPs originals and personally I can feel your passion for the topic.


I apologize for mixing up languages in the comments. It was not intended to be shown and atm I have so little time to work on the code. (I should, yes, if only to learn using the prime and maybe to reach a point were base conversions satisfies me)


//User keys


SymbModifyMenu();
SymbBaseMenu();
SymbDefineMenu();

KEY KS_Comma()
BEGIN
LOCAL n:=0, s:={"subst("+CAS.Ans+",)","solve("+CAS.Ans+"=0)","solve("+CAS.Ans+")","cSolve()","nSolve()"};

IF CHOOSE(n,"Lösen",s) THEN
RETURN s(n);
RETURN (30);
ELSE
RETURN "eval()";
END;
END;



KEY KS_Xttn()
BEGIN
RETURN ":=";
END;




///////////////////////////////////////////////////////////////////////////////////////////
//view starts my-user menu
///////////////////////////////////////////////////////////////////////////////////////////

KEY K_View()
BEGIN
LOCAL shift:=0, alpha:=0, code;
SUBGROB_P(G0, 0, 0, 39, 9, G1);

//VISUALISIEREN [a][shif]CUSTOM USER
WHILE(1) DO //Bis !shift||!alpha
BLIT(G1); //alte linke obere Ecke malen

IF shift THEN
TEXTOUT_P("s",1,0,1,#00FFFFh);
END;
IF alpha THEN
TEXTOUT_P("α",6*shift+1,0,1,#FFCC00h);
END;

TEXTOUT_P("USR",6*shift+7*alpha+1,0,1,#FFFF00h);
code:=WAIT;
CASE
IF code=41 THEN shift:=1-shift; END;
IF code=36 THEN alpha:=1-alpha; END;
DEFAULT BREAK;
END;
END;

//CUSTOM USER AUSFÜHREN
CASE
IF code=13 THEN //MENU
SymbModifyMenu();
END;

IF code=45 THEN //'3', also Basis
SymbBaseMenu();
END;

IF code=17 THEN //define
SymbDefineMenu();
END;

IF code=9 THEN //bei VIEW Fehler auslösen damit VIEW kommt
KILL;
END;

DEFAULT code; //Alle anderen Tasten einfach ausführen
END;
END;

///////////////////////////////////////////////////////////////////////////////////////////
//MY User Menu Handler
///////////////////////////////////////////////////////////////////////////////////////////

SymbBaseMenu()
BEGIN
DRAWMENU("hex","dec","bin","","2Real","#"); // Softmenü zeichnen
LOCAL inp:=WAIT(-1); // Benutzereingabe abwarten
IF TYPE(inp)≠6 THEN RETURN inp; END; // Tastaturdrucke einfach durchleiten
IF inp(1)≠#0d AND
inp(1)≠#3d AND
inp(1)≠#7d THEN RETURN ""; END; // Touchgesten (außer Klicks) ignorieren
IF inp(3)<#220d THEN RETURN ""; END; // Klick außerhalb des Menüs ignorieren
LOCAL btn:=IP(inp(2)*6/320); // Welcher Button gedrückt (0..5)?

CASE
IF btn=0 THEN RETURN " 32 4 R→B(3)"; END;
IF btn=1 THEN RETURN " 32 3 R→B(3)"; END;
IF btn=2 THEN RETURN " 32 1 R→B(3)"; END;
IF btn=3 THEN ""; END;
IF btn=4 THEN RETURN "B→R()"; END;
IF btn=5 THEN "#"; END;
DEFAULT ""; // Mehr Softbuttons haben wir erstmal nicht.
END;

END;

SymbModifyMenu()
BEGIN
DRAWMENU("factor","fact","expand","expd","partfrac","partf"); // Softmenü zeichnen
LOCAL inp:=WAIT(-1); // Benutzereingabe abwarten
IF TYPE(inp)≠6 THEN RETURN inp; END; // Tastaturdrucke einfach durchleiten
IF inp(1)≠#0d AND
inp(1)≠#3d AND
inp(1)≠#7d THEN RETURN ""; END; // Touchgesten (außer Klicks) ignorieren
IF inp(3)<#220d THEN RETURN ""; END; // Klick außerhalb des Menüs ignorieren
LOCAL btn:=IP(inp(2)*6/320); // Welcher Button gedrückt (0..5)?

CASE
IF btn=0 THEN STRING(factor(Ans)); END;
IF btn=1 THEN "factor("+CAS.Ans+")"; END;
IF btn=2 THEN STRING(expand(Ans)); END;
IF btn=3 THEN "expand("+CAS.Ans+")"; END;
IF btn=4 THEN STRING(partfrac(Ans)); END;
IF btn=5 THEN "partfrac("+CAS.Ans+")"; END;
DEFAULT ""; // Mehr Softbuttons haben wir erstmal nicht.
END;
END;

//CR Haeger
SymbDefineMenu()
BEGIN
DRAWMENU("f(x):=","f->F","F->f",":=","-","-");
LOCAL inp:=WAIT(-1); // Benutzereingabe abwarten
IF TYPE(inp)≠6 THEN RETURN inp; END; // Tastaturdrucke einfach durchleiten
IF inp(1)≠#0d AND
inp(1)≠#3d AND
inp(1)≠#7d THEN RETURN ""; END; // Touchgesten (außer Klicks) ignorieren
IF inp(3)<#220d THEN RETURN ""; END; // Klick außerhalb des Menüs ignorieren
LOCAL btn:=IP(inp(2)*6/320); // Welcher Button gedrückt (0..5)?

CASE
IF btn=0 THEN "f(x):=" END;
IF btn=1 THEN "Function.F1:=f" END;
IF btn=2 THEN "f(x):=Function.F1(x)" END;
IF btn=3 THEN "f(x):="+CAS.Ans END;
DEFAULT ""; // Mehr Softbuttons haben wir erstmal nicht.
END;

END;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Question about CAS and Graphing - Han - 09-24-2014, 10:14 PM
RE: Question about CAS and Graphing - Han - 09-25-2014, 01:35 PM
RE: Question about CAS and Graphing - jte - 11-22-2014, 03:01 AM
RE: Question about CAS and Graphing - Han - 11-22-2014, 02:31 PM
RE: Question about CAS and Graphing - jte - 11-23-2014, 06:31 PM
RE: Question about CAS and Graphing - Han - 11-23-2014, 08:42 PM
RE: Question about CAS and Graphing - jte - 11-26-2014, 06:02 AM
RE: Question about CAS and Graphing - Han - 11-22-2014, 02:16 PM
RE: Question about CAS and Graphing - Han - 11-22-2014, 07:26 PM
RE: Question about CAS and Graphing - Han - 11-23-2014, 08:41 PM
RE: Question about CAS and Graphing - Han - 11-24-2014, 11:47 AM
RE: Question about CAS and Graphing - Han - 11-24-2014, 01:29 PM
RE: Question about CAS and Graphing - Han - 11-24-2014, 02:12 PM
RE: Question about CAS and Graphing - Angus - 11-26-2014 10:15 AM



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