I am working on a screen that will display a list of equipment that the user should select from.
Currently I have 5 text widgets that can be "navigated" (line highlight shown/hidden based on variable changed by up/down keys) but I would like to have a list of 30+ pieces of equipment that displays 5 on the screen and scrolls the data with the up/down keys.
Is this possible?
Creating scrollable list
- nbrouhard
- Posts: 4
- Joined: Thu Oct 27, 2011 8:06 am
- ksaenz
- Enovation Controls Development
- Posts: 263
- Joined: Thu Aug 19, 2010 7:53 am
Re: Creating scrollable list
Hello nbrouhard,
A scrollable list is possible and here is one way to do it.
The attached configuration has five text widgets to display items from a list, 5 widgets with visible condition to indicate which item is selected, and 2 widgets to label the up/down keys.
All the programming objects are in the "ListScroll" group.
The up/down keys fire calculation events to change the index variable.
When the index variable changes it fires and event to calculate the selector variable.
When the selector variable changes it fires an event to calculate the page variable.
When the page variable changes it fires an event to run the WritePage script.
The WritePage script uses the page variable and uses it plus an offset to write to the 5 text widgets on the screen.
In this example the list data is hard coded so you need to change that part in the script to read from your list of data.
There is also a state machine to initialize the text widgets.
Like I said, this is one way to do it. If somebody else has a different way I invite them to share it with the rest of us.
Regards,
ksaenz
A scrollable list is possible and here is one way to do it.
The attached configuration has five text widgets to display items from a list, 5 widgets with visible condition to indicate which item is selected, and 2 widgets to label the up/down keys.
All the programming objects are in the "ListScroll" group.
The up/down keys fire calculation events to change the index variable.
When the index variable changes it fires and event to calculate the selector variable.
When the selector variable changes it fires an event to calculate the page variable.
When the page variable changes it fires an event to run the WritePage script.
The WritePage script uses the page variable and uses it plus an offset to write to the 5 text widgets on the screen.
In this example the list data is hard coded so you need to change that part in the script to read from your list of data.
There is also a state machine to initialize the text widgets.
Like I said, this is one way to do it. If somebody else has a different way I invite them to share it with the rest of us.
Regards,
ksaenz
- Attachments
-
- List Scroll.zip
- Created with PVCS 2.3.11147
- (117.63 KiB) Downloaded 33 times
- nbrouhard
- Posts: 4
- Joined: Thu Oct 27, 2011 8:06 am
Re: Creating scrollable list
Thank you for the sample config, that will help immensely.
You mentioned that the script will need to be changed to accommodate my list, how is that possible?
Each item in my list is a random combination of letters and numbers. How do I add my "equipment" list to the config and then incorporate it into this ListScroll script?
You mentioned that the script will need to be changed to accommodate my list, how is that possible?
Each item in my list is a random combination of letters and numbers. How do I add my "equipment" list to the config and then incorporate it into this ListScroll script?
- ksaenz
- Enovation Controls Development
- Posts: 263
- Joined: Thu Aug 19, 2010 7:53 am
Re: Creating scrollable list
You probably will need to change the line:
to
Assuming you put your strings in an array.
Regards,
ksaenz
Code: Select all
str = "Item " + i;
Code: Select all
str = strArray[i];
Regards,
ksaenz