Dynamic PopupMenu

Dear Forum,

I would like to modify the list contents of a PopupMenu (SelectSection), based on the selections made by another PopupMenu (SelectData). The code below, using
ControlUpdate
is not working for me. Tried
ModifyControl
which was also not appropriate. The example below, when case D is chosen the list in the "SelectSection" popupMenu should now include the updated contents of "SectionList".

Anyone with suggestions?

Thanks,
R.


Function Proc_SelectData(PU_Struct) : PopupMenuControl
	STRUCT WMPopupAction &PU_Struct
	
	String sWin = PU_Struct.win
	SetActiveSubwindow $sWin //This activates the subpanel where controls were selected
	
	if(PU_Struct.eventCode == 2) // mouse up			
		Strswitch (PU_Struct.popStr)	
			Case "A":
			break
			Case "B":
			break	
			Case "C":	
			Case "D":
				string quote = "\""
				String/G SectionList = quote + "Second;Third;Fourth;" + quote
				ControlUpdate /W=$sWin SelectSection
				break
			Case "Frequency (Hz)":
			break
			Case "Frequency (bpm)":
			break
			Case "Gap Time":	
			break		
		EndSwitch
	SetActiveSubwindow ## //Go back to parent window
	Else
		Return 0
	EndIF
End

You need to supply a function for populating the popupmenu. This function can then dynamically determine the contents. See
DisplayHelpTopic "PopupMenu"
and there "Setting The Popup Menu Items/function call".
Thanks Thomas!

I can see how plugging in a function as a value sort of makes sense, but something like
 ModifyControl
seemed to make more sense. I am sure there is a good reason for this.

Unfortunately I'm getting a compiling error when trying to use the exact code given as example from the help files.
I do not have any other "List" strings in my code that could originate any sort of conflict (even if this is a local string variable) - nonetheless I get a "Unknown/Inappropriate name or symbol" error (??!!).

Check screen-shot attached.

Any idea why this behavior?

Best,
R.
IgorCompileError_0.jpg (690.79 KB) IgorCompileError_0.jpg (690.79 KB)