Need help with List Box

Valley Ind

Member
Join Date
May 2013
Location
Columbiana, Ohio
Posts
38
I need to populate a List Box with various names such as "Dogs", "Cats", "Rabbits"

Then when a user selects one of those I need the name to be written to a Tag.

All I have been able to do so far is to get the index number to be written to a TAG - 1 for Dogs, 2 for Cats, 3 for Rabbits but I don't want the number I want the name.

How do I do that?
 
Your post is a little vague.
How about the equipment and software you are using.
The powers to be on this forum will want more info before even attempting an answer.
 
Assuming your plc and hmi are capable I would do the following.

Make a string array in your plc:
animal[0] = "dogs"
animal[1] = "cats"
animal[2] = "rabbits"

When the user selects a value from the listbox it sends the index number to the tag. we can call this tag selected_animal.

In your plc you can use the selected_animal tag as an index into your array.
animal[selected_animal].


Additionally, on your hmi do not type in the names directly. Have the listbox reference back to the plc string array. This way if a name is updated in the future you will only have to change the plc rather than the plc and hmi. It also simplifies troubleshooting and protects you if something was entered incorrectly.
listbox first element = plc.animal[0]
listbox second element = plc.animal[1]
 
I have a Panel View Plus 1000 and am Using FactoryTalk View ME.

On an SD card (Storage Card2) I have 15 PDF files that I can view using the built in PDF viewer FoxitReader.

I want to populate a List Box with the different file names of those PDF files and when the user scrolls down the list and selects a file, I want that file's name to be written into a string Tag that the PDF viewer will use to display the PDF file.

Right now I have a single file name hard coded into a string TAG and I can bring up that PDF all day long, but I need to be able to view any of the 15 when selected.

I did post a request for help about how to read the directory list of file names on the SD card and populate a List Box that way but got no response as of yet.

But if I can't get string data from one place and into a Tag it doesn't matter if I hard code the file names in a List Box or populate the List Box from the file names on an SD card.
 
To my knowledge you cannot create tag arrays in factorytalk me.

Your macro would look something like the following:

If listboxselection == 1 then
{pdffilename} = filename1
Else

If listboxselection == 2 then
{pdffilename} = filename2
Else

...
 
I wrote this:

If {ProgramLuncher_FoxitReader\ListBoxIndex}=1 Then
{ProgramLuncher_FoxitReader\PDF_FileLocation}="One"
Else
If {ProgramLuncher_FoxitReader\ListBoxIndex}=2 Then
{ProgramLuncher_FoxitReader\PDF_FileLocation}="Two"
Else
{ProgramLuncher_FoxitReader\PDF_FileLocation}="Three"


and tried putting it in a number of Expression areas in a number of different objects but it doesn't work anywhere.

Is a macro different that something in the Expression area?

Where and how do you write a macro?
 
On the Explorer window under Logic and Control right click on Macros and select 'New'.
Write your macro as you have done above and validate to make sure it is written correctly.

A macro can be assigned to run when a display opens or closes. It can also be assigned to run with a macro pushbutton. A macro button is found under Objects-Advanced-Macro. Draw it on the screen and assign your macro to it.

You can find more information under the Help heading in Studio and search for macro.
 
LessThanThree


Yes, I found it, I got a macro started and a button to run it too. That is what I am working on now.

But I still need a way to read the PDF file names off the SD card and populate a List Box, that is the only right way to do it. Hard coding in the file names is bad practice.

For now it will have to do.
 

Similar Topics

I'm fairly new to Rockwell software, I've had some basic training in the past but nothing too advanced. My company and I use Reliable products for...
Replies
11
Views
342
Hi all, I am having issues accessing my Cimplicity software - the site code changed after re-install and I am no longer able to attain a new key...
Replies
10
Views
169
Good day all! Can someone help me with the procedure to update Beijers E700 firmware? The Panel I am working on is firmware 2.04v and I would...
Replies
1
Views
70
Hello nice to meet you, im new in here, I'm currently trying to convert code written in STL for a S7-400 to SCL for an S7-1500, because when i run...
Replies
5
Views
318
Back
Top Bottom