
How can we have a drop-down list for set variable option in Igor ?

coltblaze
I have the set of around 30 graphs and I want to create a panel. So that I can select a single wave/ graph and display it in a sub Window to study it. I know about the set variable option which has the facility of up and down scroll buttons. I wonder if one can have his list as an option in set-variable rather than just numbers.
Have a look at:
DisplayHelpTopic "PopupMenu"
with e.g.
value = WinList( "*" , ";" , "WIN:1")
to create a popup that reports all graphs.
August 27, 2018 at 05:24 am - Permalink
It sounds to me like ChrLie is correct and a PopupMenu control is the best solution for you. But are you trying to get a control that works like a Windows editable combobox? That is, a drop-down list that can set a variety of pre-set strings, but you can also edit the string to get some custom something or other? For that, I would pair a SetVariable with a PopupMenu.
August 28, 2018 at 09:50 am - Permalink
an example might be helpful? for pairing a setVariable with a popup menu.
August 29, 2018 at 03:32 am - Permalink
You can use two SetVariable controls. One to show the graph window name and another to have the up/down arrows. This would in effect give you the ability to move up/down through the list of windows, which appears as text. Maybe this is close to what you wanted?
For example, try this:
I leave it as an exercise to make the code robust, etc.
August 29, 2018 at 05:50 am - Permalink
I didn't read the OP closely enough, I think. Are you trying to create a panel in which you can select a graph, and then select a trace from that graph?
August 30, 2018 at 09:39 am - Permalink
Well, I created the procedure to accomplish the task thanks to Kurt but the issue that I am facing right now with the code is that the code create a panel and a host panel for the preview but when I click on the host window and then directly click on the "setvariable" up and down scroll button it yields to the action desired but it previews only wave 0 while the wave output should change to WAve10 or some other wave number.
I am attaching the code
September 16, 2018 at 10:45 pm - Permalink
In reply to Well, I created the… by coltblaze
Can you create a minimal, self-contained example that illustrates the problem. Posting a large amount of code, that includes a lot of irrelevant code, is unhelpful to those who would try to help you.
I have often found that the exercise in creating such a minimal example enables me to solve the issue as it removes clutter as allows one to focus on the core issue.
September 17, 2018 at 12:11 am - Permalink
Let us say i click on the scroll button of the set variable for the first time it should display me Wave0
then let us say in order to analyze the image i clicked on the hosted panel
now I click on the scroll button again it should have shown me the Wave1 in the new panel hosted corresponding to the control panel but i still get the Wave0
then let us say i again click on the scroll button this happens again while now it should have shown me Wave2 but still it shows me Wave 0 in the new panel
let us say now say if I click anywhere on the control panel and then click the scroll button it shows me Wave3 while my Wave2, Wave 1 are just lost.
September 17, 2018 at 12:55 am - Permalink
In reply to Function SetVarProc(sva) :… by coltblaze
This is not a minimal, self-contained example. It is just a SetVariableControl function without context.
Have you verified that this function Compiles? When I try it has errors.
September 17, 2018 at 02:28 am - Permalink
well how about this:
well the waves and list shall be in the same folder.
September 17, 2018 at 06:30 am - Permalink
Have you tried testing what you have posted?
I opened a new experiment and pasted in your code. Running DoStuff() makes the wave wWinNames and makes a panel.
But, for example, ...
Makes a list of waves (that do not exist as they have not yet been created) from the top window (that has not been created yet). In addition, the comment above implies that you are trying to make a list of all graph windows.
Within the SetVarProc you have not declared a reference to wWinNames, although it works provided you are in the same datafolder as wWinNames (you do not control this in your code).
You have a string called Filename, but this is set to a wave (or window) name.
I suggest you run the code with the debugger, put a breakpoint in the SetVarProc, and step through one line at a time.
Please take time to make the example code meaningful, understand what the issue is and try to resolve it yourself. Then come back with further questions.
September 17, 2018 at 06:59 am - Permalink
In reply to well how about this: … by coltblaze
It isn't clear what the intended behaviour is. You seem to want to select a wave from a list of waves and create an image plot. A popup control is usually the best way to select an item from a list. I assume that there's some reason you want to plot in a graph subwindow of a panel subwindow, rather than simply plotting in a graph window (or subwindow). Do you want the selected wave to be plotted in the same subwindow each time you make a selection? If that's what you're trying to do you should remove any image traces from the plot and append the selected image in a named subwindow.
The following code is from your SetVarProc, with some comments added:
You should check to see if this is what you intend to do.
September 18, 2018 at 05:37 pm - Permalink