1.2k views
in Embedded Wizard Studio by
Hello

We have a volatile requirements, things will change often.

I have 2000+ menu items to display and can have 7levels of menu depth.

It would be difficult to manually manage them.

1) Does EmWiz has any support to manage them ?

Ans : ???

2) Do you suggest a separate tool(I already have one) to manage them ? In the end, i can put the menu data in different unit and integrate into EmWiz? Doing this way is good, or is there any other better way ?

Ans : ???

--

Maharaja

2 Answers

+1 vote
by

Hello,

the number of menu-items and the depth of the menu hierarchy is not a problem. Embedded Wizard provides the necessary basic components to construct menus, It is however up to you how you implement and manage the menu system. With our experience, every application case is different and every menu system expects to behave individually.

Thus I would recommend:

1. Separete the menu system in two parts: the view and the controller. The idea follows the Model-View-Controller paradigm.

2. The controller manages the menu information, the relation between the menu items, menu item labels, icons, etc. See Creating non visual components. You can implement your own classes to represent a menu and menu item. Instances of the classes can store menu information. Relations between the instances reflect the menu structure.

3. The view evaluates the information in the controller and displays it. The simplest would be to use here the VerticalList view.

In other words, you will need to implement a small menu framework, consisting of controller and view components adapted to your individual menu system expectations.

Hope it helps you.

Best regards

Paul Banach

by

Thanks for your answer.

I agree with you all your points, It all depends on how we implement them.

my question here was however not about implementation at EmWiz.

It was about the Inbuilt/External tooling solution to ease the menu adding/editing.

 

Mit freundlichen Grüßen 

Maharaja

by
Hi Maharaja,

please see my answer below.

Best regards

Paul Banach
0 votes
by

Dear Maharaja,

till now we haven't used any external tooling to manage menu systems. in the past we developed individual menu system frameworks on behalf of the customers. Our approach was to provide the customer with components, he/she can simply compose together visually in Embedded Wizard by drag-and-drop. From the composition results then the menu structure. I have developed an example demonstrating this approach. May be it helps you to progress? Feel free to modify it to your needs.

http://ask.embedded-wizard.de/?qa=blob&qa_blobid=10348282335125775454

The example demonstrates the idea of how to divide complex menu systems in a 'content' (model-controller) and 'presentation' (view) part. 

A.) When you open the example, you will find two units:

- unit Menu contains the implementation of a simple menu framework

- unit Application contains an example of a menu constructed using this framework.

The individual components are described in annotations within the project. Please note also the descriptions I left for the various members as well as the inline comments within the methods.

B.) The most important aspects are:

- A menu is defined by menu-item objects within a menu class.

- There are four prepared menu item classes (SubmenuItem, ToggleItem, ActionItem and ExitItem).

- Every menu-item class has few properties to determine e.g. the caption or the icon to show in the menu.

- You can add more properties to the item classes e.g. additional text, icons, etc.

- You can also modify/enhance how the four item classes appear and behave.

- You can duplicate any item class and implement your own particular special menu items (e.g. an item intended to store a command string, which is sent to a device as soon as the user has activated the item, etc.).

- To define a new menu derive a new class from Menu::Menu.

- In the new class add as many instances of the menu-item classes as you require in the particular menu.

- Please note the order of menu-item instances within the menu class. It corresponds to the order in which the items are presented later on the screen. The order can be reviewed in Inspector.

- The presentation of items is handled by the component Menu::MenuView.

- For this purpose the class Menu::MenuView provides few methods to open/close a menu.

- Menu::MenuView manages the history of currently opened menus so you navigate forth and back through complex hierarchies of menus.

C.) Usage cases:

In the praxis we see 4 possible usage cases how menu systems can be created and managed:

Case 1: Manually at the design time

This is exactly the approach I described above. It is also demonstrated in the attached example:

- For a new menu, you derive a new class from Menu::Menu class.

- Then you feel it with menu-item instances.

- Finally you specify the values for properties of every item (e.g. caption, slot method to call when the item is activated, etc.)

Case 2: Programmatically

This is an approach useful when the content of the menu is dynamic depending on e.g. data received from a device, etc. This is also demonstrated in the attached example. In this case:

- You create first a new instance of the Menu::Menu class. At the moment such menu is still empty.

- Then you create dynamically all the necessary menu item objects.

- You configure the properties of every menu-item object (e.g. its caption, etc.)

- Finally you add the just created menu item objects to the menu by calling its AppendItem() method.

- Please note the order in which the items are displayed on the screen corresponds to the order in which they have been added to the menu.

Case 3: Generating EWU file

Thanks to the separation of content and presentation, the definition of a menu is relatively slim. Every menu is a individual class containing embedded objects - one object for every item. If required, it should be possible to use external tools (e.g. macros running in Excel) to automatically generate such EWU files. A menu within the EWU file looks like this:

class SubMenu : Menu::Menu
{
  inherited property Caption = "Sub-Menu 1";

  object Menu::ActionItem ActionItem1
  {
    preset Caption = "Action 1";
  }

  object Menu::ActionItem ActionItem2
  {
    preset Caption = "Action 2";
  }

  ...

  object Menu::ExitItem ExitItem
  {
    preset Caption = "EXIT";
  }
}

Case 4: Interpreting Menu-description from files at the runtime.

The last case addresses the approach to implement an interpreter, which at runtime reads menu configuration files and depending on the contents found there creates menus and fills these with menu-items (as describe in case 2).

So far the possible cases.

From my point of view, the case 1 is the simplest one. Sure, you have to implement every menu manually. But compared with the effort to e.g. implement an Excel --> EWU converter (case 3) or an config-file interpreter (case 4), it seems for me less intensive.

Important is, that you have adapted the menu framework to your particular project requirements. In its current version it is just a example common for the typical menu applications.

Last but not least, once you have the various basic components implemented, you can add your own templates for them to the Gallery. In this manner you can conveniently drag-and-drop the components from the Gallery to the Composer.

What do you think? Does the example help you further?

Best regards

Paul Banach

by
Hi Paul,

The programmatic menu you provided is really helpful! I'm having trouble implementing it with submenus though. Do you think you could explain or provide an example of creating the submenus programmatically?

Thanks!
by

Hi,

with Embedded Wizard there is also another menu example provided. Use the Open Example dialog and select there the example Menus.

From technical point of view, sub menus are ordinary menus you instiate just in the moment when the user activates the right menu item in the superior menu. In the example Menus every menu is implemented as an individual GUI component. When the user enters a sub-menu, we create a new instance of the corresponding sub-menu GUI component, show it on the screen and redirect all user inputs to this sub-menu. Later, when the user leaves the sub-menu again, we hide the sub-menu instance and redirect the user inputs back to the superior GUI component.

Following question are interesting:

- How to create dynamically an instance of a GUI component? See: Compose the component programmatically

- How to redirect the user inputs to a GUI component? See: Modal GUI components.

Hope it helps you further

Best regards

Paul Banach

by

Hi,

I download this example but I have this error...Can you tell me what's worng?

Thanks,

Michal.

by

Hello Michal,

I just downloaded and tested the example. It works as expoected. Possibly there is something wrong with UNZIP? After you download and unzip the ZIP file, you should get a directory with following files:

Can you verify it? Eventually you try to open the project file from inside the ZIP. In such case unzip the ZIP file first.

Best regards

Paul Banach

by
Thank you... I really didn't pay attention for it....

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...