Popvalue problem

I am trying to create a popupmenu and set the value that is shown using the "popValue" keyword, but I can't get the popValue keyword to influence the control. Here is a simplified version of my command:

        popupMenu taskSetPop, popValue="test2", value="test1;test2"

This results in a control that shows "test1", not "test2".

The full command I am trying to implement is:

    popupMenu taskSetPop, value="DAME;FIDOH;TREM;CBL", pos={2+buttnWd,buttnPos}, size={buttnWd, buttnHt}
    popupMenu taskSetPop title="TaskSet", fsize=12, align=1, popValue=taskSet, proc=taskSetPopUpProc

where the string "taskSet" contains the value selected by the user.

Hi,

Perhaps you need to do a controlupdate.

ControlUpdate [/A /W=winName ] [controlName ]
The ControlUpdate operation updates the named control or all controls in a window, which can be the top graph or control panel or the named graph or control panel if you use /W.
Flags
/A    Updates all controls in the window. You must omit controlName .
/W=winName    Specifies the window or subwindow containing the control. If you omit winName  Igor will use the top graph or control panel window or subwindow.
    When identifying a subwindow with winName, see Subwindow Syntax for details on forming the window hierarchy.
Details
ControlUpdate is useful for forcing a pop-up menu to rebuild, to update a ValDisplay control, or to forcibly accept a SetVariable's currently-being-edited value.

Andy

I think you want the mode keyword for this.

popupMenu taskSetPop, value="test1;test2", mode = 2

popValue is admittedly confusing, but it sets the initial text on the PopUpMenu if the mode isn't zero. Note that this doesn't have to correspond to the currently selected item, or any item at all. If you scroll down in the PopupMenu documentation you'll eventually reach a section describing what the Popvalue keyword is intended for.

... also, if you want to set the popup menu to a certain item using a string and not the mode keyword, you would need to use popMatch. I this also needs to happen after the control has been created and set up.

 popupMenu taskSetPop, popmatch="test2"

Note that this command will do nothing if the requested item is not found in the current popup list. Yeah, popup controls are a bit fiddly.

This:

 popupMenu taskSetPop, popmatch="test2"

worked!

Correct, Chozo, I want the popMenu to show a value based on a string.

The mode=n works too but I'd have to first calculate the numerical-order location of the desired option based on my string and the available options for the menu.

Executing "ControlUpdate" alone did not work for me, but that was before I tried the subsequent suggestions, and these do not seem to need a ControlUpdate execution.

Thank you everyone!