How to make a layer visible/invisible with a double click?

Started by ccuddihy, April 12, 2016, 05:28:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ccuddihy

I'm a noob.  I'm trying to make a layer visible/invisible with a double click. I've got an example- ImageOnOffRev2- but I haven't been able to pick out the part I need.  Can anybody spoon feed me the way to do this?


ccuddihy

This is the example. The 'Hide Images/Show Images" is pretty much what I'm trying to duplicate.  I think the answer is contained in EventDblclick.

Hey Ken


   Hi, cchuddihy.  Here's a way I use to turn the display of certain shapes on and off:

On your page:
   - Insert your layer(s) (if not already there)
On the page shapesheet:
   - Insert an Actions section
   - On the first row, in the Action column, add the following formula:


=IF(ThePage!Layers.Visible[1]=1,SETF(GetRef(ThePage!Layers.Visible[1]),0),SETF(GetRef(ThePage!Layers.Visible[1]),1))


   - Be sure to replace "[1]" with the row number of the layer (in the Layer section) associated with the shapes you want to turn on and off.  You'll notice that Visio automatically removes "[1]" from the formula, but not "[2]".
   - In the Menu column, add the following formula:


=IF(ThePage!Layers.Visible[1]=1,"Show","Hide")


   That's it.  When you want to turn the layer on and off, right click on the page background and choose "Show" or "Hide" respectively.  Pretty straightforward. 

   As for spoonfeeding, I'm assuming you know how to define layers and assign shapes to them, and how to access and insert sections in the page's shapesheet.  Chime in if I'm wrong.

   As for EventDblClick, you could use that event on, say, a button.  Putting the same Actions formula above in the EventDblClick would allow the button to turn the shapes on and off. Up to you how you'd like the ergonomics.



   - Ken

Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com