Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
crtbl_ring_menu.4gl | 2020-05-11 | 463 Bytes | |
readme.txt | 2020-05-11 | 3.0 kB | |
tbl_ring_menu.4gl | 2020-05-11 | 8.7 kB | |
Totals: 3 Items | 12.2 kB | 0 |
From: acilia@mail.ptl.com.mt (Andrew Cilia) Newsgroups: comp.databases.informix Subject: Table-driven ring menu Date: 30 Sep 1997 09:33:26 -0400 Just a little explanation: MNMS is the Menu header which contains a system name and a menu name. This is linked to MNDT in a one to many relationship where each MNDT is a menu option. The row contains a sequence number, an option type, the text of the option and a path to the executable or function. Now there are 4 mndt_types: "T" is just text which is displayed on the screen, "M" which leads to a submenu (i.e. mndt_path must contain a menu code), "P" which runs a free-standing program (i.e. mndt_path must contain something like "fglgo xyz" or "vi xyz.4gl") and finally "F" which leads to a function. Since I have not found any way to call a variable function name, "F" is implemented via a function called redirector which is a massive case statement of the form "CASE function when "a()" call a() when "b()" call b() .... otherwise display "don't know that one!" The program takes care of centering the options on the screen and looks pretty good. If you get this working and make it sexier, please send me a copy. Andrew Cilia - Philip Toledo Limited At 14:11 29/09/97 -0400, you wrote: >MIS Dept wrote: >> >> We're modifying our menu structure for our homegrown Informix code. Instead of creating >> a ring menu with all various front-end programs linked into a single executable, we're >> looking to split out the various front-ends into separate executables, then create a >> table-driven menu structure. While we can make a 'drop down' style menu relatively >> easy, we would like to keep the ring menu structure for our user community. Any way to >> create a table-driven ring menu? I figure that someone may have already asked this >> question, but I could find no reference in the newsgroup archive. > >Here's a kludge to accomplish this: > >1) Initialize arrays of strings for menu choices and prompts to NULL. >2) In the code, physically before executing the menu statement, fetch > the actual choices and prompts into the array. >3) Create a menu with the maximum number of items possible using > an array of variables for the choice and prompt strings for all. In > the code for BEFORE MENU clause test if the choice for each array > element corresponding to the menu item is NULL, if NULL execute HIDE > OPTION choice[n] otherwise execute SHOW OPTION choice[n]. >4) The command for each choice (except any fixed choices like EXIT) > would be a call to a function, passing the choice number or name, > which would execute the appropriate code based on the argument(s) > passed to it. This function could be written in 4GL with a big case > statement or "C" using an array of function names or id#s and > function pointers. > >You get the picture. The only rub is the phrase "maximum possible >number of choices" this may be hard to determine at coding time. > >Art S. Kagel >