Post Reply 
[REPORT] problem with choose CMD
12-03-2016, 04:27 PM (This post was last modified: 12-07-2016 02:23 PM by compsystems.)
Post: #1
[REPORT] problem with choose CMD
Hello

The logic of the following code fails, because choose must return 1 when [OK/ENTER] is pressed


PHP Code:
export INPUTtest0()
    
begin
      local coef1_a
coef2_bcoef3_ccoef4_d
      
coef1_a:=9coef2_b:=8coef3_c:=7coef4_d:=6;

      
local reset_coef1_areset_coef2_breset_coef3_creset_coef4_d
      
reset_coef1_a:=3reset_coef2_b:=2reset_coef3_c:=1reset_coef4_d:=0;

      
local init_coef1_ainit_coef2_binit_coef3_cinit_coef4_d
      
init_coef1_a:=coef1_ainit_coef2_b:=0init_coef3_c:=0init_coef4_d:=0;

      
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 ok:=1;
      
local cancel:=0;
      
local keyPress:=0;
      
local currentPos:=2;
      print(); 
freeze;

      
keyPress:= input( { {coef1_a, [ObjectType_Real]}, {coef2_b, [ObjectType_Real]}, {coef3_c, [ObjectType_Real]}, {coef4_d, [ObjectType_Real] } }, "a x² + b x + c = 0 ∨ ax²+bx=d",  {"a:""b:""c:""d:"}, {"Enter coeff a""Enter coeff b""Enter coeff c""Enter coeff d"} , {reset_coef1_a,0,0,0}, {init_coef1_a,2,3,4} );

      print(
"Key press for INPUT CMD: " ifte(keyPress == ok,"[OK/ENTER]","[ESC]") );
      if 
keyPress == ok then
        coef3_c 
:= coef3_c-coef4_d// => ax²+bx+c=0
        
print( "a=" coef1_a );
        print( 
"b=" coef2_b );
        print( 
"c=" coef3_c ); wait;

        
//keyPress:=0;
        
keyPress:= choose(currentPos,"test choose",{"a","b","c"});

        print(
"Key press for CHOOSE CMD: " keyPress ); // 0 for [CANCEL], 1 for [OK/ENTER]
        
print("Key press: " ifte(keyPress == ok,"[OK/ENTER]","[ESC]") );
        print( 
"selected position = " currentPos ); wait;
        if 
keyPress == ok then
          
print("Key press for CHOOSE CMD: " keyPress ); wait;
        
end;
      
end;

      return 
"done";
    
end
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[REPORT] problem with choose CMD - compsystems - 12-03-2016 04:27 PM
RE: problem with choose CMD - eried - 12-03-2016, 04:40 PM
RE: problem with choose CMD - compsystems - 12-03-2016, 05:05 PM
RE: problem with choose CMD - StephenG1CMZ - 12-03-2016, 05:33 PM
RE: problem with choose CMD - Han - 12-04-2016, 04:21 AM
RE: problem with choose CMD - Tim Wessman - 12-05-2016, 03:28 PM
RE: problem with choose CMD - eried - 12-03-2016, 06:12 PM
RE: problem with choose CMD - StephenG1CMZ - 12-03-2016, 06:27 PM



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