Post Reply 
[REQUEST] reset field ([<-] key) "input" cmd
12-07-2016, 01:10 PM (This post was last modified: 12-07-2016 10:21 PM by compsystems.)
Post: #1
[REQUEST] reset field ([<-] key) "input" cmd
Hello hp-prime developer group

Request/Idea:
I: Pressing the [<-] key, generates a popup or menu showing:

1: Reset [current] value
2: [All]
3: [exit]

II: Type valids with [HELP] key

(INFORM cmd of the hp48/50) do this.

PHP Code:
«
  0  keyPressedOnMenu
  «
    0 
'Real' STO
    1 
'Complex' STO
    2 
'String' STO
    3 
'RealMatrix' STO
    4 
'ComplexMatrix' STO
    5 
'List' STO
    6 
'Identifier' STO
    8 
'Program' STO
    9 
'Algebraic' STO
    10 
'BinaryInteger' STO
    13 
'Unit' STO
    
"title"
    "label_a" "help_a"
  
Real Complex String  RealMatrix
  ComplexMatrix 
List Identifier
  Program Algebraic BinaryInteger
  12 LIST

    
"label_b" "help_b" }
    
2 LIST
    
1 2 } @ pos
    
NOVAL 5 }      @ reset value a}
    { 
123 NOVAL } @ init value    a}
    
INFORM
     
'keyPressedOnMenu' STO
    
IF keyPressedOnMenu 1 ==
    
THEN
    
ELSE
    
END
  »
» 

Purpose: Avoid accidental deletion of fields.

Currently pressing the [<-] key, deletes the current field of input cmd, sometimes it is uncomfortable because the [<-] key, is not visible in the menu ([edit] ... [cancel] [ok]) of INPUT and can be accidentally pressed.

[Image: dialogBoxes_inform_hp50_image00.png]

What do programmers and users say about this idea?
Find all posts by this user
Quote this message in a reply
12-07-2016, 08:55 PM (This post was last modified: 12-07-2016 09:07 PM by compsystems.)
Post: #2
RE: [REQUEST] reset field ([<-] key) "input" cmd
I found a problem when resetting values with [<-] key, by default always set 0, this should not be so because it is not always the value of the correct defined data type

These are the default reset values that do not generate INVALID DATA TYPE and that should be implemented, not in the following firmware but if in the future, you agree?

Quote:-1: all -> EMPTY FIELD (NULL)
0: real -> put 0
1: integer -> 0
2: string -> ""
3: complex -> 0
4: matrix -> [0]
6: list -> {}
8: function -> 'X'
9: unit -> 0_u

Test each field from the following code, Comment and uncomment for each case
If you press [<-], then [edit] menu -> "Error: Invalid Input"
PHP Code:
export input0()
begin
    local a
bc;
    
local resetVAL_aresetVAL_bresetVAL_c;
    
local initVAL_ainitVAL_binitVAL_c;

    
//initVAL_a:=1; initVAL_b:=2; initVAL_c:=3; // real 0 
    //initVAL_a:=#FFFh; initVAL_b:=#FFh; initVAL_c:=#Fh; // integer 1 
    //initVAL_a:="abc"; initVAL_b:="123"; initVAL_c:="\"X\""; // string 2
    //initVAL_a:=i; initVAL_b:=(3,4); initVAL_c:=3+4*i; // complex 3
    //initVAL_a:=[1]; initVAL_b:=[2]; initVAL_c:=[3]; // matrix 4
    
initVAL_a:={1}; initVAL_b:={2}; initVAL_c:={3}; // list 6 
    //initVAL_a:=cas( "f(x):=x+20" ); initVAL_b:=cas( "f(x):=x+30" ); initVAL_c:='A+B'; // function 8
    //initVAL_a:=1_m; initVAL_b:=2_cm; initVAL_c:=3_inch; // unit 9

    //resetVAL_a:=0; resetVAL_b:=0; resetVAL_c:=0; // real 0 
    //resetVAL_a:=0; resetVAL_b:=0; resetVAL_c:=0; // integer 1 
    //resetVAL_a:=""; resetVAL_b:=""; resetVAL_c:=""; // string 2
    //resetVAL_a:=0; resetVAL_b:=0; resetVAL_c:=0; // complex 3
    //resetVAL_a:=[0]; resetVAL_b:=[0]; resetVAL_c:=[0]; // matrix 4
    
resetVAL_a:={}; resetVAL_b:={}; resetVAL_c:={}; // list 6 
    //resetVAL_a:='X'; resetVAL_b:='X'; resetVAL_c:='X'; // function 8
    //resetVAL_a:=0_u; resetVAL_b:=0_u; resetVAL_c:=0_u; // unit 9
    
    
local ObjectType_AllAllowed := -1;
    
local ObjectType_Real := 0;
    
local ObjectType_Integer := 1;
    
local ObjectType_String := 2;  
    
local ObjectType_Complex := 3;  
    
local ObjectType_Matrix := 4;
    
local ObjectType_List := 6;
    
local ObjectType_Function := 8;  
    
local ObjectType_Unit := 9;  
    
local ObjectType_CAS := 14;

    
local ObjectType := ObjectType_List;
    
local title;

    case
        if 
ObjectType == -1 then title:="Type Allow: "+"Alls" end;
        if 
ObjectType == 0 then title:="Type Allow: "+"Real" end;
        if 
ObjectType == 1 then title:="Type Allow: "+"Integer" end;
        if 
ObjectType == 2 then title:="Type Allow: "+"String" end;  
        if 
ObjectType == 3 then title:="Type Allow: "+"Complex" end;  
        if 
ObjectType == 4 then title:="Type Allow: "+"Matrix" end;
        if 
ObjectType == 6 then title:="Type Allow: "+"List" end;
        if 
ObjectType == 8 then title:="Type Allow: "+"Function" end;  
        if 
ObjectType == 9 then title:="Type Allow: "+"Unit" end;  
        if 
ObjectType == 14 then title:="Type Allow: "+"CAS" end;
     default
        
title:="Type Allow: "+"?"
     
end;

    
local ObjectType_Real := 0;
    
local ObjectType_Integer := 1;
    
local ObjectType_String := 2;  
    
local ObjectType_Complex := 3;  
    
local ObjectType_Matrix := 4;
    
local ObjectType_List := 6;
    
local ObjectType_Function := 8;  
    
local ObjectType_Unit := 9;  
    
local ObjectType_CAS := 14;

    
local ok := 1;
    
local cancel := 0;
    
local keyPressedOnMenu := 0;
    
keyPressedOnMenu := input 
    
(  
        { 
         {
a, [ObjectType] }, 
         {
b, [ObjectType] },
         {
c, [ObjectType] }

        }, 
        
title,
        { 
"label_a""label_b","label_c" }, 
        { 
"help_a""help_b""help_c" },           
        { 
resetVAL_aresetVAL_bresetVAL_c }, 
        { 
initVAL_ainitVAL_binitVAL_c 
    );
    if 
keyPressedOnMenu == ok then
        
return ({abc});  
        
//return ({expr(a), expr(b), expr(c)}); // for -1 
    
else
        return 
"Done";
    
end;
end

A help for data types
[Image: objectTypes_hp_prime_image00.png]
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: