The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Program not working in newer firmwares
08-25-2022, 02:18 AM
Post: #1
Program not working in newer firmwares
Hello, i had the following program in my calculator that would show a customizable menu screen whenever i typed shift+alpha+math. But in the current firmware it doesnt work anymore. I didnt create the program, in fact i dont know anything about HPPPL... Does anyone know how to fix it?It indicates a syntax error in the line 49: "EXPORT menuList :="


// --------------------------------------------------------------------------
//
// Originally intemded to display "Program"->"Edit"->"Cmds" tree
// directly in CAS or HOME without program editing.
//
// usage:
// - called with <Shift>+<User> plus <Alpha><Shift><Space>
// (2 times <Shift>+<User> keeps user key mode active)
// - <enter>, <OK> or touch on a command in main or sub menu returns selected item
// - <Esc> in main menu will close popup
// <Esc> in sub menu will return to main menu entry
// - <up>, <down> and swipe to move in popup (<left><right> are NOT usable)
// - starts with last returned sub- or mainmenu entry selected
// starts last visited submenu selected when ended with <Esc>
// - adopt 'menuList' to your needs. Remove 'menuAct' and 'menuList' from this code,
// when you want to use different menus in different Apps.
//
// 'menuList' contains the menu definition in a list. Each entry is described by a
// sub list with text to display as the 1st and text to return as 2nd entry.
// When the 2nd value is again a list, the entry is interpreted as a submenu containing
// the sublist entries to display and return. A sample:
// EXPORT menuList :=
// { { "display_text1", "output_text1" },
// { "display_text2", "output_text2" },
// { "submenu1" , { "menu1_display_and_output1",
// "menu1_display_and_output2",
// "menu1_display_and_output3"
// }
// },
// { "submenu2" , { "menu2_display_and_output1",
// "menu2_display_and_output2"
// }
// }
// };
//
// Stay healthy!
// Frank P. Mar 2021
// hisory:
// V 0.01 Feb 2019 - initial
// V 1.0 Mar 2021 - menuAct added to remember last choose
// - menuList both display and return text as list of lists
// (inspired by ramon_ea1gth CSTMENU)
//
// --------------------------------------------------------------------------
// { "km/l <-> l/100km", "kml()" },

EXPORT menuAct := {1,0};
EXPORT menuList :=
{ { "evalc" , "evalc()"
},{ "re" , "re()"
},{ "im" , "im()"
},{ "csolve" , "csolve()"
},{ "rectangular to polar" , "RectangularPolar()"
},{ "polar to rectangular" , "PolarRectangular()"
}
};

KEY KSA_Math

BEGIN
LOCAL choose_list, choose_title, ch, ret, i;
/////////////////////////// check the menu entries ///////////////////////////////////
FOR i FROM 1 TO SIZE(menuList) STEP 1 DO
// 1st entry is a string and 2nd entry is a string or a list and 2nd entry not empty
IF ( TYPE(menuList(i,1)) == 2 ) AND ( (TYPE(menuList(i,2)) == 2) OR ( TYPE(menuList(i,2)) == 6 ) ) AND SIZE(menuList(i,2)) THEN
// OK
ELSE
MSGBOX(" INVALID MENU ENTRY: " + STRING(menuList(i)) );
RETURN "";
END;
END;

WHILE 1 DO
//////////////////////// prepare the choose arguments //////////////////////////////
// string as 2nd argument => in main or a submenue entry and that is not active
IF (TYPE(menuList(menuAct(1),2)) == 2) OR ( (TYPE(menuList(menuAct(1),2)) == 6) AND (menuAct(2) == 0) ) THEN
choose_list := MAKELIST(menuList(X,1), X,1,SIZE(menuList));
choose_title := "Commands";
ch := menuAct(1);
END;
// at a submenue entry and it is active
IF ( TYPE(menuList(menuAct(1),2)) == 6 ) AND (menuAct(2) > 0) THEN
choose_list := menuList(menuAct(1),2);
choose_title := menuList(menuAct(1),1);
ch := menuAct(2);
END;

////////////////////////////// choose a menu entry //////////////////////////////////
ret:=choose(ch,choose_title,choose_list);

IF menuAct(2) == 0 THEN
///////////////////////////// handle main level ///////////////////////////////////
menuAct(1) := ch; // remember main selection
IF ret==0 THEN // choose ended with esc
RETURN "";
ELSE
IF TYPE(menuList(menuAct(1),2)) == 2 THEN // a string as 2nd entry
RETURN menuList(menuAct(1),2); // return selected entry
END;
IF TYPE(menuList(menuAct(1),2)) == 6 THEN // a list as 2nd entry
menuAct(2) := 1; // activate submenu
END;
END; // something selected?
ELSE
//////////////////////////////// and sub level ///////////////////////////////////
menuAct(2) := ch; // remember sub selection
IF ret==0 THEN // no entry selected
menuAct(2) := 0; // back to main level
ELSE
RETURN choose_list(menuAct(2)); // return with selection
END;
END; // in sub menu?
END; // while choosing
END; // menu
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Program not working in newer firmwares - pedrodebem - 08-25-2022 02:18 AM



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