Passing more infos into PopupMenu list functions
Wed, 07/21/2021 - 01:23 pm
I have a GUI with a SetVariable and a PopupMenu. The function providing the popup menu entries would need to read another GUI control for doing its job. As that is not possible, I now always have to reset the function defining the string for the popup menu.
return GrepList("abcd;efgh", searchString)
SetVariable searchstring, value = _STR:".*",proc=SetVarProc
PopupMenu pop, value=#"GetList(\".*\")"
Function SetVarProc(sva) : SetVariableControl
STRUCT WMSetVariableAction &sva
case 1: // mouse up
case 2: // Enter key
case 3: // Live update
PopupMenu pop, value=#("GetList(\"" + sva.sval + "\")")
Now I would prefer if the GetList function would be passed a struct similiar to WMSetVariableAction so that it could dynamically generate the list itself. This new struct should have at least a window name and control name member.
My current approach makes the code quite complicated, and also took a non-trivial amount of time to get the quoting in the popupmenu value string right ;)