Question regarding popup menu at start up
proland
I'm writing a program which loads text files, stores the waves in child data folders, and keeps a running list of the filenames. When it comes time to process the data, I want to use a popup menu, where the list is generated from the global string in which I keep the filenames. Unfortunately, if I open a new Igor file, I get an error because the string does not exist yet. To avoid this, I have to use
svar importedfiles
popupmenu selector value=#importedfiles
popupmenu selector value=#importedfiles
However, when the popup menu is actually made, the only option is "_error_". If I remove the # symbol, which tells igor that the value might not exist at compile time, the popup menu is made correctly. Of course, this brings me back to the problem of the error on starting a new Igor file.
How am I supposed to use a string list, in this case a global string, for the popupmenu value properly? Is there another way I should be setting the popupmenu list items?
Thanks
If you look at the section Setting The Popup Menu Items in the documentation for PopupMenu, you see several underlined sub-sections, each of which describes a way to specify the popup menu items, depending on what you are trying to accomplish.
You are using "# followed by the name of an SVAR". However, this is not one of the options.
I think you should use "# followed by a local string variable containing a path to a global string variable".
Thus, assuming that your global string variable is in the root data folder, you would write:
popupmenu selector value=#path
If root:importedfiles does not exist when this is execute, the popup menu will show _error_ until such time as root:importedfiles does exist and the popup menu items are set either by re-executing the commands above or by the user choosing an item.
March 5, 2012 at 01:01 pm - Permalink
March 6, 2012 at 06:31 am - Permalink