Ask Reuben
Consider Using TREE Instead Of StartMenu
With StartMenu how can I … ?
When answering a question that involves StartMenu, I tend to find that my first response is “Have you considered replacing StartMenu with equivalent functionality using a TREE container?”
The two screenshots below are both from FGLDIR/demo, and are both using similar .4sm file. The first image is from FGLDIR/demo/StartMenu using a StartMenu, the second image is from FGLDIR/demo/Tree/start-menu using A TREE container that was added to Genero in 2.20.
Both have the similar hierarchical view that groups programs together, allows you to expand and collapse until you find what you are looking for, and allows the end-user to select a program to start by double-clicking on the appropriate row.
The reason I favour TREE over StartMenu is that it allows you to combine your Tree with the rest of what is in the Genero developer toolbox. The StartMenu is very simple but with that simplicity comes restrictions.
The TREE container …
- has the built-in find. So a user can find the program they want to run by using Ctrl-F.
- selecting a row does not have to do an exec command, but can be used to call a function.
- allows additional columns to add additional data, such as when last run, or number of times run.
- the ability to sort on these extra columns
With TREE in a DISPLAY ARRAY you can …
- programmatically add actions to manipulate the tree contents
- programmatically change variables that are used to start a program
- programmatically control what happens when a row is selected
With TREE you can use Multiple dialog to combine the underlying DISPLAY ARRAY with …
- an INPUT that allows user to start program by entering program name or short-code if they know it and pressing ENTER (e.g. type op01 to launch Order Processing instead of having to find it in the Tree)
- an INPUT with a RADIOGROUP to filter the number of visible rows
- a DISPLAY ARRAY to list workflow entries that can also be used to launch programs
- an INPUT using WebComponents of Charts (perhaps fglsvgcanvas) to display KPI information that can also be clicked on to start a program
With TREE you do not need to repopulate the StartMenuCommand nodes to change an argument. An example I give is a solution where perhaps you want to switch between databases and you pass the database as a command line argument to the running program. With a StartMenu you need to repopulate the exec attribute of every StartMenuCommand node in the AUI Tree with the new value, with a Tree solution this is something you can programmatically incorporate at the time the RUN command is constructed.
I once put together a Proof of Concept that combined this that looked like this …
The features that were combined into one multiple-dialog include …
- INPUT + EDIT to search through the Tree container
- INPUT + ON ACTION to filter the Tree container
- The TREE container equivalent of Start Menu
- INPUT + ON ACTION to reset selections
- DISPLAY ARRAY + ON TIMER to populate workflow entries that the user can click on to start a program
- INPUT + WEBCOMPONENT, click on chart to start a program
Final point I want to stress with this answer. StartMenu is supported 4gl syntax, it has NOT been marked as “Deprecated”, nor does it have the other kiss of death phrase “Provided for backwards compatibility” associated with it. As long as you are not tied to the “menu” view with StartMenu, I think a solution using a TREE container gives you more functionality, flexibility and control. If you were using this then I don’t think you would be asking the “How do I…” question with a StartMenu.