Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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]


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

without success.

share|improve this question
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. – Sjoerd C. de Vries Jun 17 '12 at 7:30
@SjoerdC.deVries I'd agree but sometimes in these situations that reflects inadequate documentation rather than inadequate functionality. – Mike Honeychurch Jun 17 '12 at 22:40
lol.. Mike, I just tried doing exactly this. – Amatya Sep 25 '12 at 2:23
up vote 4 down vote accepted

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}, 
  Overlay[{Slider2D[], Graphics[{Opacity[.2], Disk[]}]}, All, 
  Dynamic[layer]], {{"MouseClicked",  2} :> ((layer = layer /. {1 -> 2, 2 -> 1}))}, 
 PassEventsDown -> True]]
share|improve this answer
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. – Mike Honeychurch Jun 17 '12 at 3:35
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. – Mike Honeychurch Jun 23 '12 at 1:52
@Mike, thank you for the accept. – kglr Jun 23 '12 at 5:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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