Hello Harshini,
I suppose that with "coming back to the menu screen" you present a new instance of the menu. Consequently, the new instance has no information about the selection you made in the preceding instance. Here we see two possible approaches:
Approach 1: Reuse the same instance of the menu. This would mean that the instance is not created using the new operator each time it is presented. Instead you maintain one instance for example in a variable existing in your Application component and you use this instance when the menu should be presented.
The disadvantage of this approach is, the menu occupies RAM the whole time. This may be even few kB RAM depending on the menu content. The usage of this approach depends thus on the resources of your target.
Approach 2: Store the selection information (the number of the recently selected item) in a variable outside the menu. Next time, when the menu is presented again, read the variable and use it to restore the previous selection situation. In the simplest case, you would need to store the content of the property Vertical List property SelectedItem. To manage a variable outside the menu you could use an autoobject. It is a kind of global object which allow you store global data. In your application case it could be sufficient to manage in the class of the autoobject just one int32 variable.
You could store the content of the property SelectedItem in a variable existing in the autoobject each time the user changes the selection in the menu. Later when the menu is presented again, you read the variable from the autoobject and use it to restore the property SelectedItem. Depending on the design of your menu, you could implement this in the Init() method of the Menu component or in the UpdateViewState() method.
This approach requires more coding. On the other hand it is more flexible. You could even store the content of the autoobject in a flash memory so the menu selection can be restored even after the device has been switched off in the meantime.
Important: If you are using autoobjects, please note that they are automatically discarded if not used anymore. Therefore, if the autoobject is used from the Menu only, you will need to store a reference to the autoobject within a variable existing in Application component. See also the section Lifetime of an autoobject.
I hope it helps you further.
Best regards
Paul Banach