Interactive DIP Switch Shape

Started by YossiD, February 08, 2009, 10:26:05 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

YossiD

I have created a grouped shape of a DIP switch to be used in test equipment diagrams (attached). I'm looking for a way to get the individual switch to toggle between the OPEN and CLOSED positions. I thought of using EventDblClick, but I'm not experienced with that function and I haven't managed to get it to work.

I have a feeling this can be done making each switch in the bank a group of three shapes consisting of the outline and two smaller filled rectangles, one in the OPEN position and one in the CLOSED, with one of them visible and the other not. The double click event would swap the visibility attributes of the two small rectangles.

I also thought of a possibility of a right click option for the complete bank of switches that would bring up a table wherein one could specify which switches are OPEN and which are CLOSED.

All suggestions/solutions gratefully appreciated.

Paul Herber

#1
Just a very quick response as I'm a bit busy ...
In the shape's shapesheet have a look at the Actions section, this is how you can add new commands to the shape's right-click menu. Toggling the menu item will change the "Checked" value, the fill formula (for example) of your shape can test this value and change the fill colour.
Or look at the formula used by the "Flowchart shapes" shape in the Flowchart stencil.

Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

aledlund

#2
sounds like a great project to implement Chris' discussion on multishapes (elsewhere on his site),
al

wapperdude

#3
Take a look at the attached drawing.  It uses double click event.  It's something I did awhile back...cleaned-up the file.
Visio 2019 Pro

YossiD

Thanks, this is very helpful. Looks like it's more complicated to do than I originally thought, but hopefully your example will see me through.

Zigoto

#5
Pls find here enclosed the Dip Switch I have made.
Right click on the shape to select Open or Closed switch

Ziorg77

YossiD

#6
Whoa, looks like you've done all the work for me. Now I just have to work through it to understand how it all works.

Huge thanks.

Visio Guy

#7
Nice work, Ziorg77!

I've added a modified version of the DIP switch shape. Depending on how you use it, this might be an easier way to set the switches. Instead of setting each item, you enter an 8-digit bit-mask in a Shape Data field.

So to turn all of the switches on, you enter: 11111111. To turn them off, enter 00000000

You see the Shape Data window by toggling it via: View > Shape Data Window, or View > Custom Properties Window in older versions of Visio.

This shape might come in handy, say, if you were dropping lots of them on a page using automation code. It would be much easier and faster to set the switch values. For novice users or occasional changes, the first version is much better.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

aledlund


Visio Guy

Ooops, I suppose the 0s should be open and the 1s closed?
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Zigoto

Thanks Visio Guy,
It's always the same question with the Dip Switch Open=On=1 or Open=Off = 0
I use to say "OpenOffO" in one word to remember
Great job, perfect with "OPEN = ON = 0" string instead of "OPEN"

Ziorg77

YossiD

Thanks Ziorg and Visio guy for your excellent solutions. Not only have you provided me with the shape I need, but I have learned a lot by looking at the shape sheets for these solutions. It would have taken me days to figure this out on my own.

zhuravsky

One more version.
No actions, no bit masks...
Just slide a switch as per usual, use mouse instead of screwdriver.
:)

YossiD

Thanks zhuravsky.

With three solutions now this is really an embarrassment of riches!

Where do you guys find the time to do this? I can't even find the time to try to understand exactly how the solutions work.

Thank you all.

zhuravsky

#14
Hi,
It takes not so much time if you know how, I spent may be 30 minutes for previous variant.
Enjoy one more variant: "3d" dip switch

Edit: images added by Visio Guy to show off zhuravsky's very cool shapes