4
$\begingroup$

From the documentation:

Overlay[{Subscript[expr, 1],Subscript[expr, 2],...},{i,j,...},s] allows selections to be made and controls to be clicked in Subscript[expr, s].

and an example of selecting one layer:

Overlay[{Slider2D[], Graphics[{Opacity[.2], Disk[]}]}, All, 1]

Does anyone know what the syntax is for cases in which you want controls to be clicked in more than one layer, or all layers?

I have tried:

Overlay[{Slider2D[], Graphics[{Opacity[.2], Disk[]}]}, All, All]

and

Overlay[{Slider2D[], Graphics[{Opacity[.2], Disk[]}]}, All, {1,2}]

without success.

$\endgroup$
  • $\begingroup$ As far as I'm concerned nothing in the phrasing of the documentation suggests that you should be able to use more than one layer for selections. $\endgroup$ – Sjoerd C. de Vries Jun 17 '12 at 7:30
  • $\begingroup$ @SjoerdC.deVries I'd agree but sometimes in these situations that reflects inadequate documentation rather than inadequate functionality. $\endgroup$ – Mike Honeychurch Jun 17 '12 at 22:40
  • $\begingroup$ lol.. Mike, I just tried doing exactly this. $\endgroup$ – Amatya Sep 25 '12 at 2:23
4
$\begingroup$

I don't think the third argument of Overlay can be used to do what you want. An alternative is to change the active layer dynamically using EventHandler as in

 DynamicModule[{layer = 1}, 
 EventHandler[
  Overlay[{Slider2D[], Graphics[{Opacity[.2], Disk[]}]}, All, 
  Dynamic[layer]], {{"MouseClicked",  2} :> ((layer = layer /. {1 -> 2, 2 -> 1}))}, 
 PassEventsDown -> True]]
$\endgroup$
  • $\begingroup$ thanks for the thoughts on a work around. I am primarily hoping that this can be done with existing options before exploring alternatives. It seems like an oversight if it cannot be done. $\endgroup$ – Mike Honeychurch Jun 17 '12 at 3:35
  • $\begingroup$ Correct, WRI tech support advise that you can only have one "active" layer. This is disappointing because if you design an interface with multiple layers where the embedded controls in each layer are visually separated -- despite layers being overlayed -- it would be nice to have all controls active. $\endgroup$ – Mike Honeychurch Jun 23 '12 at 1:52
  • $\begingroup$ @Mike, thank you for the accept. $\endgroup$ – kglr Jun 23 '12 at 5:52

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.