Post Reply 
How Drawmenu work's?
01-25-2017, 11:18 PM
Post: #19
RE: How Drawmenu work's?
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

primer
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
How Drawmenu work's? - fabio.hdl - 11-03-2016, 05:02 PM
RE: How Drawmenu work's? - Han - 11-03-2016, 06:41 PM
RE: How Drawmenu work's? - Tyann - 11-03-2016, 07:02 PM
RE: How Drawmenu work's? - StephenG1CMZ - 11-03-2016, 08:58 PM
RE: How Drawmenu work's? - toml_12953 - 11-04-2016, 02:28 PM
RE: How Drawmenu work's? - primer - 11-11-2016, 07:31 PM
RE: How Drawmenu work's? - fabio.hdl - 11-05-2016, 08:22 PM
RE: How Drawmenu work's? - compsystems - 11-12-2016, 01:36 AM
RE: How Drawmenu work's? - primer - 11-12-2016, 10:41 AM
RE: How Drawmenu work's? - compsystems - 11-12-2016, 02:53 PM
RE: How Drawmenu work's? - primer - 11-12-2016, 08:36 PM
RE: How Drawmenu work's? - StephenG1CMZ - 11-12-2016, 08:23 AM
RE: How Drawmenu work's? - compsystems - 11-12-2016, 09:05 PM
RE: How Drawmenu work's? - primer - 11-12-2016, 10:04 PM
RE: How Drawmenu work's? - compsystems - 11-14-2016, 04:03 AM
RE: How Drawmenu work's? - StephenG1CMZ - 11-14-2016, 09:03 AM
RE: How Drawmenu work's? - ggauny@live.fr - 01-25-2017, 12:11 PM
RE: How Drawmenu work's? - ggauny@live.fr - 01-25-2017, 05:06 PM
RE: How Drawmenu work's? - primer - 01-25-2017 11:18 PM



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