23 views
in GUI Development by

GoodDay to All.

in my design i have made a horizontal list where it acts as a menu.
 

when i first call the list after initialization the items are there but are not pressed as expected.

see first image.

 

when i click on one of the items of the list, it is highlighted and the corresponding component is made visible.

see second image.

 

when i click on back button i am back at my main screen with other stuff but when i come back to the setup screen the last chosen item is highlighted.

see third image.

 

i want the red border to disappear after the list is made visible again. or if that is not possible make it bring the last open item page.

in my method i am using it like this

 

press the button to call setup bar

 

mainpage items are false
this.SetupTopBar.Visible = true;
this.SetupTopBar.Enabled = true;

 

inside my SetupTopBar component there is a touch screen with horizontal list

// Ignore the case, when the user interaction has been passed over to the slide touch handler
if ( SimpleTouchHandler.AutoDeflected )
  return;

// Get the index of the item at the tapped position
var int32 itemNo = HorizontalList.GetItemAtPosition( SimpleTouchHandler.CurrentPos );

// If the item is valid ...
if ( itemNo >= 0 )
{
  // Select the item in the Vertical List. Thereupon the item appears highlighted
  HorizontalList.SelectedItem = itemNo;
}

switch (itemNo)
{
 case 0:
 {
  trace " Pressed on TimeDate";
  postsignal onTimeDatePress;
 }
 case 1:
 {
  trace " Pressed on Password";
  postsignal onPasswordPress;
 }
 case 2:
 {
  trace " Pressed on Language";
  postsignal onLanguagePress;
 }
 case 3:
 {
  trace " Pressed on IPSetup";
  postsignal onIPSetupPress;
 }
 case 4:
 {
  trace " Pressed on Reset";
  postsignal onResetPress;
 }
 default: ;
}

and the slot onTimeDate is connected to property slot onTimeDatePress which gets activated

 

inside slot onTimeDate

 

this.Setup_TimeDate.Visible = true;
this.Setup_TimeDate.Enabled = true;

every other list item is false

 

inside my Back button slot

 

this.Setup_TimeDate.Visible = false;
this.Setup_TimeDate.Enabled = false;

every other list item is false

mainscreen items are true

 

I know i could have used presentdialog or switchtodialog to get screens but visible true false method seemed like easier for my beginner level.

 

 

 

 

 

1 Answer

+1 vote
by

Hello,

the current selection corresponds to the value stored in the list's property SelectedItem.

When you return to the component containing the menu and you want the red border to disappear, you have to explicitly set the property SelectedItem = -1. This removes the selection again.

In turn, if you want the corresponding page to be presented just in the moment when you return to the menu, you have to evaluate the value of SelectedItem and post a signal to corresponding slot method (e.g. onTimeDatePress if SelectedItem == 0).

Summarised, whenever you return to the 'menu' component, you have to execute some code to either remove the selection or show the corresponding page.

Does it help you further?

Best regards

Paul Banach

by
Good Morning.

Yes i have added the line SetupTopBar.HorizontalList.SelectedItem = -1; inside my back button slot. Now when i go back and call the list again it does not start highlighted.

Thank you very much.

See you guys in next questions :D

Embedded Wizard Website | Privacy Policy | Imprint

...