How to open file from popupmenu

Folks,
Please Help:
What I have is:

A folder containing any number of (all string) files:
Each file in the folder consists of a filename and a column of ~360 numbers
Filename
-3.66
1.44
*
*
What I need is:
When an item from the popupmenu list is selected I want to automatically recover the associated filename and the ~360 numbers in a list.

All help is appreciated.
Regards,
Art Peters

You need to associate the items in the popup menu with the names of the files. Then when the popup menuitem is selected you get the file name and go open and read it. You need to figure out how to make the aforementioned association. One way is to have the file names as the items in the popup menu. Another is to create a dictionary of menuitem names as the key and the filename as the value. Another way is to…well you get the idea. Just decide what works for your situation.

Dale,
Thank you for your reply. I likely am not understanding the several distinctions you mentioned. The names in the popup are the same as those of the files. I assumed that they are the names of the actual files.

So the popup file names are NOT the actual file names of a file? Is that also true of list boxes, etc.?

What does one do specifically to make the necessary associations? Or better, a reference to this issue in any printed reference would very much be appreciated.

Hi Art,

You need to get your head around object oriented programming.

Each file in the folder should be represented by a FolderItem.

So you let the user select the folder, iterate through all the files and for each file create a new FolderItem and set it to the file.

Then add a new entry to the PopupMenu with the FolderItem.name as the text and store the FolderItem itself in the RowTag (an invisible storage area that each row has).

When a user selects an item from the PopupMenu you use the FolderItem stored in the RowTag to access and open the file.

That’s just reinventing what the RowTag already provides.

Markus:
Thank you. Over time you, Dale and many other listers have been big help to me.
I wrote the program I am trying to resurrect more than 25 rears ago. (It’s a biggie, more than 15000 lines of code.) Now I am trying to bring it into this century. And kept up until about 10 years ago with Xojo.

I found correct code in my current old Xojo version and had and have forgotten a great deal. But you folks prompted me that I had already written the necessary code in the change event of the popup.

Thanks Again