Author Topic: Displaying List with the Screen Menu Library  (Read 1049 times)

Offline spittet

  • PLUS+1 Guru
  • *****
  • Posts: 113
  • Karma: +5/-1
Displaying List with the Screen Menu Library
« on: May 22, 2020, 09:55:03 PM »
Hi,

What is the best way to display strings that are from a list when we use the ScreenMenu library?

I understand how to do it for the CreateNumeric and CreateBoolean block, but not for the CreateList block.

Here's my menu setup :
- I have 4x MenuItems blocks.
- I have a SubMenu block that have 2x CreateList and 4x CreateNumeric blocks.
- Each CreateList block contains 3x CreateText blocks.
- For each CreateList block, the CreateText descriptions are differents (so, two kind of lists basically)

On the ScreenDefinition, I can easily do the following :
- Display the correct MenuTitle
- Display the correct MenuItemDescription
- Enable a NumericData textfield if the actual MenuItem is of Numeric type.
- Display the correct numeric data in the NumericData textfield using the "MenuX.Data" input
- Enable a TextList if the actual MenuItem is of List type.


But, I can't do the following :
- Display the correct "CreateText" string of the actual list. There is no input like "MenuX.String".

I tried the MenuX.TypeString, but it does not work, because it is only related to a CreateBoolean block.

Currently, I'm obliged to use the "MenuX.Data" input as the ActiveIndex of the TextList and place "constant text" inside this textList. The problem doing this, is that I have two different kind of lists. So, I need to place 8 TextLists (4x for each type of list) and add some logic to enable them or not. And because the actual position of the TextList can be anywhere between the 4 MenuItems, it's hard to code for this behavior.


It would have been so much easier if there was an input like "MenuX.String" for the ScreenDefinition to return the actual string of the list to be displayed for a specific MenuItem.


Let me know the good way to do this.

Have a good day!

Offline Tor

  • Administrator
  • PLUS+1 Guru
  • *
  • Posts: 139
  • Karma: +10/-1
Re: Displaying List with the Screen Menu Library
« Reply #1 on: May 27, 2020, 01:03:33 PM »
Hi Spittet,

Got this from a developer.

"-There is no quick method programmatically to show the selected string of a list, but it is possible.
I’ve attached an example of how to do it and it looks correct on my bench, it should be easy enough to adapt."

I hope this helps.

Take Care
Best regards
Tor
PLUS+1 Helpdesk team

Offline spittet

  • PLUS+1 Guru
  • *****
  • Posts: 113
  • Karma: +5/-1
Re: Displaying List with the Screen Menu Library
« Reply #2 on: May 29, 2020, 08:50:46 PM »
Hi,

Yes. I see how it should work. I will use it. Thanks!

I still think that if this ScreenMenu function block was improved so that "Data" output was returned as a String, no matter if it comes from a CreateNumeric or CreateBoolean ro CreateList block, it would be easier to display any kind of data.
You could even have some parameters for the CreateNumeric blocks for "Multiplier" and "Divider" so that the String "Data" could be formatted as "X.XX" from a numerical "XXX" value by example.
Doing the same way, there could be a new parameter that could serve to display the "units" of the wanted displayed data. Simply add/concat this "unit" String parameter at the end of the "Data" string just before releasing it at the output of the  CreateNumeric or CreateBoolean ro CreateList block

I can see the example SCS file joined in the above post getting pretty messy if there are a lot of different lists, each containing a lot of differents texts, and imagine if there are multiple languages to support. All of this could be embedded directly in the Screen_Menu function block for a simpler usage for the end user.

Anyway, thanks for the example SCS file, I will definately use it for now!

Sam