Dynamic PopupMenu
rhjpires
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
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
DisplayHelpTopic "PopupMenu"
and there "Setting The Popup Menu Items/function call".October 30, 2017 at 01:44 pm - Permalink
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.
October 30, 2017 at 03:22 pm - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
October 30, 2017 at 03:52 pm - Permalink
Cheers,
R.
October 30, 2017 at 11:34 pm - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
October 31, 2017 at 09:30 am - Permalink