
Dynamic PopupMenus in panels with subwindows

rhjpires
I have several popupmenus in multiple subwindows of a panel.
For some of the popupmenus I need a dynamic display of contents so that the list is populated depending on other controls within that panel. For that, I have defined the value of those popupmenus as a function that returns a list depending on choices made by the users on other controls within the same panel. That function I call here "FuncSelectList" (e.g.
PopupMenu Dynamic_PU, title="Select Something", value=FuncSelectList()
). I would like now to generate/pass awareness of which panel was clicked when I click on one of these dynamic popupmenus. My problem is that the moment that a dynamic PopupMenu is clicked, FuncSelectList() is called and I do not see how I can generate/pass subwindow awareness within that function. For a Proc() I would use an inbuilt structure in order to access the WIN variable, such as :
Function Proc_SelectData(PU_Struct) : PopupMenuControl STRUCT WMPopupAction &PU_Struct String sWin = PU_Struct.win SetActiveSubwindow $sWin //some more code goes here End
Is there a way I could take advantage of a structure within FuncSelectList() so that I can access the WIN variable? Or is there any other way I can raise window awareness within FuncSelectList()?
Thanks in advance,
R.
EccentricXPS#XPSViewPopUpWaveList(2, SubWindow, DataFolderPopUp)
every time the popup menu is clicked. Keep in mind that in your example the popup menu list is only generated once when the menu is created (if I remember correctly). To make the list dynamic you need the #("xxxxx"). There is a long description somewhere in the popup menu help.PopupMenu DisplayedWavePopUp value=#("EccentricXPS#XPSViewPopUpWaveList(2, \""+SubWindow+"\", \"DataFolderPopUp\")")
November 2, 2017 at 12:56 am - Permalink
How you are actually defining your
SubWindow
variable? I think that is my main question.Below is how I have implemented the dynamic aspect of the second
PopupMenu SelectSection
whose value is defined byFuncSelectList1()
using a Strswhich-Case-EndSwitch statement. For proper use, the user has to first make a selection on the left side PopupMenu (SelectData) which contains a simple list. Upon interaction with that popupmenu, the SubWindow number is passed to a global variableActiveSubPanel
which is recalled by FuncSelectList1() upon interaction with the dynamicPopupMenu SelectSection
which then uses that to read the selection of the SelectData popupmenu of the same panel.The problem of this approach is that correct functioning requires the user to first select the popupmenu on the left (
PopupMenu SelectData
) and then proceed to popupmenu on the right (PopupMenu SelectSection
). I would like for the subwindow to be detected and that being passed to the value ofPopupMenu SelectSection
November 2, 2017 at 08:32 am - Permalink
Regards,
Kurt
November 2, 2017 at 08:49 am - Permalink
Quick question though: what might be the best approach to write this if for instance I would instead force the dynamic popupmenu to be populated upon interaction with the first (static) popupmenu, rather than, as I do now, for the list to be defined only upon user interaction with the dynamic popupmenu.
I'am actually quite happy that it works, but was wondering of how could be written differently.
Many thanks again!
Cheers,
R.
November 2, 2017 at 10:40 am - Permalink
November 2, 2017 at 01:20 pm - Permalink
I see the commonalities between your example
value=#("PopUpValue(\""+WindowName+"\")")
and Kurt's
value=#("FuncSelectList1(\""+WinName(0, 64) + "#" + sSubPanelName+"\")")
Both of which are helpful in my case.
However, I was also wondering if it is possible to use the statitc PopUpMenu (PopUpOne) to dynamically push the value to be taken by the dynamic PopupMenu (PopUpTwo, in your case), in a way refreshing/updating that control, rather than having PopupTwo reading the status of PopOne only when interacted with. Any guesses if this possible at all?
November 2, 2017 at 11:56 pm - Permalink
Try this function (substitute it into the code I provided previously):
Cheers,
Kurt
November 3, 2017 at 01:01 am - Permalink
November 3, 2017 at 01:04 am - Permalink
Cheers Kurt & Olelytken!
R.
November 3, 2017 at 01:16 am - Permalink