11-19-2016, 04:48 AM
HELLO, the next code, calls a second file, if this is renamed the program does not run, connKit renames with a posftfix if there are two files with the same name. To solve this problem for example ti68k calculators, each file has a name inside the program code, this name is the operation name but not the file name, I think that this idea should be implemented in hp-prime
#FILE name
LIBRARY FILE:
TEST FILE
#FILE name
LIBRARY FILE:
PHP Code:
//#FILE LibMenu;
#pragma mode( separator(.,;) integer(h32) )
// LibMenu "simple" v 1.0 primer october 2016
local m,a; // menu entries and actions
local p,t,ar;
// start to reset.
resetMenu()
begin
m:={"","","","","",""};
a:={"","","","","",""};
end;
// to draw menu entries
draw()
begin
drawmenu(m(1),m(2),m(3),m(4),m(5),m(6))
end;
// to register menu etries
export entryMenu(p,t,ar)
begin
m(p):=t;
a(p):=ar;
end;
callitMenu(f)
begin
if f=="" then return; end;
expr(f);
draw();
end;
// to manage events, trigger actions
eventsMenu()
begin
local e;
if mouse(1)<200 then return; end;
e:=1+floor(mouse(2)/53);
callitMenu(a(e));
end;
TEST FILE
PHP Code:
//#FILE LibMenuTest;
#pragma mode( separator(.,;) integer(h32) )
local stay:=1;
export LibMenuTest()
begin
stay:=1;
print("stay:="+stay); wait(0.5);
LibMenu.resetMenu();
entryMenu(1,"menu1","tstLibM.f1()");
entryMenu(2,"menu2","tstLibM.f2()");
entryMenu(4,"menu4","tstLibM.f4()");
entryMenu(6,"exit","tstLibM.quitMenu()");
LibMenu.draw(); //;
while stay==1 DO
LibMenu.eventsMenu();
end;
print("stay:="+stay); wait(0.5);
return "Done";
end;
f1()
begin
msgbox("1st menu " + "stay:=" + stay);
//print("stay:="+stay); wait(0.5);
end;
f2()
begin
msgbox("2st menu " + "stay:=" + stay);
//print("stay:="+stay); wait(0.5);
end;
f4()
begin
msgbox("4 menu " + "stay:=" + stay);
//print("stay:="+stay); wait(0.5);
end;
quitMenu()
begin
stay:=0; // you will quit nicely the WHILE loop
// print("stay:="+stay); wait(0.5);
end;