335 views
in Embedded Wizard Studio by

Hi,

We implemented Menu Framework with Menu Composite template,but we have a specific usecase in scrolling mentioned below

Here initially Item 1 to 4 are in the Display and when on Item4 which is in the 4th position if a select happens , corresponding menu will be displayed. After that exiting from Item 4 will lead to Previous Menu with selection in Item 4 in 4th position in display.

And if we scroll down once Item 1 will go out of display and in the Item 2 to 5 will be in Display with cursor on Item 5. From there if a Up key is Pressed the cursor will move to Item 4 and if a select happens corresponding menu will be entered and on exiting from that menu, previous menu should be displayed with cursor on Item 4 but in this case Item 4 is in 3rd position in the display.

Problem: (marked in green above)

So if a Up key is Pressed the cursor will move to Item 4 and if a select happens corresponding menu will be entered and on exiting from that menu, previous menu should be displayed with cursor on Item 4, but in this case Item 4 is in the 4th position in the display instead of 3rd position when Outline.EnsureVisible() is used.

Anyway to fix this issue? i.e. in this case Item 4 should be in the 3rd position as explained in the flow chart

Best Regards,

Preethi S,

Robert Bosch - India

 

 

1 Answer

0 votes
by

Hello Preethi,

your description indicates that the main-menu displayed before the selection occurred, and the main-menu displayed after the sub-menu has been exited are two different instances. Consequently, the new main-menu instance being created after the return from the sub-menu has no information about the previous scrolling position. So far, using the method EnsureVisible() produces the expected behaviour - the item #4 is visible.

What can you do?

Option 1: Reuse the same instance of the main-menu.

This means, when you enter the sub-menu, the main-menu should remain in RAM. When you return from the sub-menu just display the 'old' main-menu again. If you are using the Dialog functionality to present the menus, the task is very simple. Concrete: when the user activates a menu item in the main-menu, just call PresentDialog() to display the corresponding sub-menu. With this operation the preceding main-menu will be hidden, faded-out or overlaid by the sub-menu. The exact visual effect is determined by the parameters of the PresentDialog() invocation. Later when the user exists the sub-menu just dismiss it by using the invocation DismissDialog(). This makes the previous main-menu visible again. As it is still the same menu instance, the scrolling position and all other internal states are still unchanged.

Option 2: Remember the scroll position within the main-menu.

Before you present a sub-menu remember the actual scroll position of the Outline component. In other words store the content of the Outline's property ScrollOffset in some variable. The variable should be configured with the type point. The variable should exist in an object which will survive the menu interaction. Later when the user exists the sub-menu and you creates a new instance of the main-menu use the value stored in your variable to adjust the scroll position to correspond to the previous value. In other words, you assign the value of the variable back to the Outline's property ScrollOffset.

Does it help you further?

Best regards

Paul Banach

by
Thanks Paul , Option 2 worked for us

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

...