2
$\begingroup$

I am building a large Manipulate application with about 50-60 checkboxes through which the user can select entities to be drawn on a main canvas. The main drawing routine, called from within Manipulate is defined as:

Clear@drawingRoutine;
Options@drawingRoutine={"draw01"->False,"draw02"->False,...,"draw60"->False};
drawingRoutine[param1_,param2_,opts:OptionsPattern[]] := Module[{...},...]

I have two basic questions, referring to getting the data from manipulate controls into a list of options, and backward:

1) Since drawingRoutine[] accepts a large number of switches as optional parameters, what is the right programmatic pattern to go from Manipulate's long list of controls to the options list without writing each by hand.

2) As a convenience, the Manipulate application allows the user to select, via a menu, a particular "view", each of which corresponds to a list of things to draw. I encode these as an association:

viewAssoc = <|
   "view01"->{"draw01","draw11","draw10"},
   "view02"->{"draw50","draw03"},
   ...
|>

So my second question is, having recovered the options associated with the view selected in the drop-down menu, how do I transfer it to the list of controls within Manipulate in a non-manual way (the latter one has 60+ controls).

Ideally, I could list all the controls in Manipulate as a "Hold" list:

ctrlList = Hold@{ctrl1,ctrl2,ctrl3,...}

However this is not ideal as order would matter. I would like to assign/read/modify control symbols in a programmatic way where all the controls and options are handled as an orderless list. For example, having them be in an association of some kind:

<|ctrl1->"draw01",ctrl1->"draw02",...|>

Or perhaps the opposite:

<|"draw01"->ctrl1,"draw02"->ctrl2,...|>

The trick here is what gets evaluated when and how?

Does that make sense?

Dan

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.