11-26-2014, 10:15 AM (This post was last modified: 11-26-2014 10:56 AM by Angus.)
Post: #31
 Angus Member Posts: 212 Joined: Feb 2014
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

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;

///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////

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
END;

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

IF code=17 THEN //define
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;

///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////

BEGIN
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;

BEGIN
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
BEGIN
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;
 « Next Oldest | Next Newest »