Force a Selection in Popmenu by entry number
Hi,
I have a folder with sample ids and multiple images per sample.I have a simple viewer where the user selects an item, sample id, from popmenu1 and that creates a new list, images of that sample, for popmenu2. I can get it to refresh using controlupdate all well and good. The tweak I would like: When the popupmenu1 selects an item the viewer will get the first image of the list for popmenu2. That all works.
Now the challenge, if before selcting a new sample the popmenu2 was on entry 2, when the system updates the control for popmen2, entry 2 is still selected. If the users doesn't select a new items from popmenu2 he is presented with the wrong image id. Is there a way when updating the control of popmenu2, I can force it to go to entry 1.
Controlinfo shows the popup entry number so it is in there somewhere.
Clear as mud?
Andy
Andy,
Use the "mode" keyword to set the current value. Note that it is 1-based, not zero-based.
popupmenu popup0, mode=3
Sets the popup menu to the third item in the list.
So, in your case, use mode=1.
September 11, 2023 at 12:37 pm - Permalink
In reply to Andy, Use the "mode"… by jtigor
Thanks.
I must of read the documentation 3=4 times looking for it.
September 11, 2023 at 12:43 pm - Permalink
It's kind of subtle and easy to overlook!
September 11, 2023 at 01:37 pm - Permalink