Note : Red Highlight indicates the current focus
how to find whether the current focused element is the last visible element in the menu display?
In the above flow diagram, Initially the Cursor will be in Item1 . Then on each down it will move to Item2,Item3,Item4 ... Item7 again on down it will move to Item1.
Note : The number of visible elements in the display at a time can be 4 Items,
Here how to find whether the current focused element is the last visible element in the menu display (i.e. Item 4, Item5 and Item6 respectively for Case 1, Case2 and Case3 as mentioned above will be the last visible item in the display and also it will be in Focus).
Any API's to get the same?
Note : We are using Outline.EnsureVisible() to bring the Item to Focus
Robert Bosch - India
compare in this case the Bounds of the Item with the Bounds of the surrounding area. Assuming, the items are managed within an Outline, calculate an intersection between the Bounds of the Item and the Bounds of the Outline. If the intersection is empty, the item lies completely outside the area. If the intersection is equal to the Bounds of the item, the item lies completely within the area. Finally if none of the cases is true, the item lies partially inside/outside the area.
To calculate the intersection use the & operator. to compare the rectangles after the intersection use the == operator. To test whether a rectangle is empty you can also use the instant property isempty. For example, to test whether ItemX is inside or outside the area of Outline:
if (( ItemX.Bounds & Outline.Bounds ) == ItemX.Bounds )
trace "the item is completely inside Outline";
if (( ItemX.Bounds & Outline.Bounds ).isempty )
trace "the item is completely outside Outline";
EDIT: An additional hint: with the EnsureVisible() method you already achieve the effect of automatically scrolling the Outline contents. Just invoke EnsureVisible( FocusedItem ) just after changing the focus. The method takes care of scrolling the menu or, if it is not necessary, it returns without doing anything.
Does it help you further?
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!