Hi ggauny,
I wanted to modify your program to show how to use with libMenu, but your program can't compile, these functions are missing : N->J(), CALD(), DOE(), and DTM().
to make it compilable, I removed their call, date computation results will not be the expected one.
So, I "converted" your program. simply by moving actions into local functions.
to demonstrate I simply handle first level menu.
You can compare with your program,
you will see than main program is no more a bulk of code, each one are now in function.
Code:
// -- forward decl (2nd menu)
MENU2();
LOCAL stay;
// -- usefull function
wait_and_clear()
BEGIN
WAIT(-1);
RECT();
END;
// -- menu functions
EXPORT Button1()
BEGIN
LOCAL N→Ja:=0;
INPUT (N→Ja,"Number date to Julian Date number","dd.mmyyyy =", "Enter number date");
TEXTOUT_P("JDN = ",32,51,3);
TEXTOUT_P(N→Ja,89,51,3);
wait_and_clear();
END;
EXPORT Button2()
BEGIN
LOCAL dd1:=0,dd2:=0;
INPUT ({dd1,dd2}, "Difference between two dates in days",{"1st Date","2nd Date"}, {"dd.mmyyyy =", "dd.mmyyyy ="});
TEXTOUT_P("ΔDAYS: ",5,81,3);
TEXTOUT_P(dd2-dd1,65,81,3);
wait_and_clear();
END;
EXPORT Button3()
BEGIN
LOCAL dp1:=0,dp2:=0;
INPUT ({dp1,dp2},"Date+",{"date","xdays"},{"dd.mmyyyy =", "number"});
TEXTOUT_P("New Date:",1,81,3);
TEXTOUT_P(dp2,80,81,3);
wait_and_clear();
END;
EXPORT Button4()
BEGIN
LOCAL doey:=0;
INPUT (doey,"Year of Easter= ", "Enter year");
TEXTOUT_P(doey,1,161,3);
wait_and_clear();
END;
EXPORT Button5()
BEGIN
MENU2();
//todo refresh with 1st menu when back from 2nd one.
END;
EXPORT Button6()
BEGIN
stay:=0; // leave
END;
// -- Main program ......................
EXPORT DTM1()
BEGIN
// DFX Main Menu
// WMWK 2014-09-19
stay:=1;
LibMenu.reset();
LibMenu.entry(1, "N→J", "Button1()");
LibMenu.entry(2, "Δdays", "Button2()");
LibMenu.entry(3, "date+J", "Button3()");
LibMenu.entry(4, "doe", "Button4()");
LibMenu.entry(5, "time", "Button5()");
LibMenu.entry(6, "exit", "Button6()");
LibMenu.draw();
WHILE stay DO
LibMenu.events();
END;
END;
MENU2()
BEGIN
//todo : same mechanism as first menu.
//LibMenu.reset()
//LibMenu.entry(...)
END;
by the way it fixe the problem you had when exiting... as we don't need KILL, there no more message at the end.
but to make it work, download
the LibMenu