Author Topic: Animation (toggle show and hide of connections)  (Read 20208 times)

0 Members and 1 Guest are viewing this topic.

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3645
  • Ideas Visio-lized into solutions
Re: Animation (toggle show and hide of connections)
« Reply #15 on: October 23, 2014, 08:10:04 PM »
Added the double click to all shapes...there's a "bug".  The macro "toggles" the connectors period.  That means you cannot progressively go thru and show more and more connectors.  If a shape has connectors showing from some other shape being double clicked, when the next shape is double clicked, it will turn show some connectors and hide those previously connected.

Depends upon what you want to do ultimately.

Wapperdude
Visio 2019 Pro

Yacine

  • Hero Member
  • *****
  • Posts: 2643
Re: Animation (toggle show and hide of connections)
« Reply #16 on: October 23, 2014, 09:04:50 PM »
@Wapperdude,
no, I was not faster than you.
I had to rewrite the whole event handler.
I wish there would be some really generic code snippets, one could easily adjust.
But that's way upon my level.

So this new version features a toggle button to set the drawing in either presentation or edit mode.
There's also the possibility to select several shapes and show accordingly their connections.
Yacine

darrenj1471

  • Newbie
  • *
  • Posts: 7
Re: Animation (toggle show and hide of connections)
« Reply #17 on: October 24, 2014, 04:00:11 AM »
Ok both the hover example and the double click event one are exactly what Im after.   Now......if only I knew how to write macros..

(I will dig out my copy of visio for dummies)

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3645
  • Ideas Visio-lized into solutions
Re: Animation (toggle show and hide of connections)
« Reply #18 on: October 24, 2014, 11:06:10 AM »
Couple of things: 
  1.  A somewhat different visual approach...based upon previous work...double click a shape and the macro highlights the shape, plus the attached connectors and shapes at the opposite ends of the connectors.  That is, the complete "network" of the selected shape.  All other shapes are grayed out, but, still lightly visible.  I think this has less "shock" value of all or nothing.  It still allows the viewer to see the context.
  2.  Double click another shape, without the need to double click the first shape, and the emphasis moves to the new shape.
  3.  Repeat double click of same shape will return everything to black lines.

As far as programming goes, the Dummy book probably won't help too much.  Generally, running the macro recorder is a good start.  Also, studying the examples of other macros.  The free download of the SDK has many code examples.

Wapperdude

Ed.:  Cleaned up the code, especially the comments.  Also, added a deselect step to clean-up after macro finishes.
« Last Edit: October 25, 2014, 12:42:34 AM by wapperdude »
Visio 2019 Pro

darrenj1471

  • Newbie
  • *
  • Posts: 7
Re: Animation (toggle show and hide of connections)
« Reply #19 on: October 27, 2014, 10:23:04 AM »
Ok Ive worked out how to record macros (granted, this wasnt difficult) and I now have some shapes and some macros which if I run they map the connectors between Shape A and B or between C and D for example.  I presume I need to also record a macro where I delete these connectors and this is how I toggle them off?

If I run the same create macro twice it seems to place new connectors on sheet which I dont want....?

What Im now failing to understand is how to assign double click to effect the toggling

Actually there is a fair bit Im failing to grasp so perhaps give me a few days before you end up getting frustrated with my lack of macro skills :)
1. Maps connections between shape A and shape B
2. Removes connections between shape A and shape B
3. Maps connections between shape C and shape D
4. Removes connections between shape C and shape D

Now if run them in order then all is good ie 1 then 2 and then 3 then 4.  I know I cant run 2 before 1 (obviously) as it errors.  BUT if I run 1 and then 3 things goes bad.  The connections from 1 dissapear and a random orphaned connection appears.  Then if I run 1 again after 3 it gets worse ie more orphaned connectors. ....

(Finally, Yacine on your hover up vsd I cannot see any macros so no idea how youve done it)
« Last Edit: October 27, 2014, 11:27:21 AM by darrenj1471 »

Yacine

  • Hero Member
  • *****
  • Posts: 2643
Re: Animation (toggle show and hide of connections)
« Reply #20 on: October 27, 2014, 11:28:39 AM »
Hi Darren,
there are so many questions in your post, that I don't know where to start.
It is obvious, that you lack the very basics of Visio. (sorry)
What about a generous donation to the forum and we prepare a solution that you can use as it is?
http://www.visguy.com/about/donate/
Yacine

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3645
  • Ideas Visio-lized into solutions
Re: Animation (toggle show and hide of connections)
« Reply #21 on: October 27, 2014, 04:27:10 PM »
Quote
Ok Ive worked out how to record macros (granted, this wasnt difficult) and I now have some shapes and some macros which if I run they map the connectors between Shape A and B or between C and D for example.  I presume I need to also record a macro where I delete these connectors and this is how I toggle them off?

Not sure why you'd do this.  Thought you already had a drawing and all you wanted to do was manipulate it for viewing/discussion purposes.  To access the macros, hit <alt> F11.  Then, expand modules > NewMacros.  The code should be visible.

First decision you need to make:  use mouse hover or use double-click.  Yacine did the development for this mouse over approach.  He can answer questions relative to that.  I'm happy to cover the double-click approach questions.

If you decide to use double click, there are two approaches presented:  1.) the show / don't show as you requested, or 2.) the highlight alternative approach.  Both of these would require shapesheet editing to be able to invoke the macro with the double click event.  As a starting place, take a look at approach (2), the code is a little cleaner with better comments.  It will help you understand, even if you stick with approach (1).  Open both the Visio drawing window and the VBA window and tile them side-by-side.  Select a shape (single click) in the drawing window, then move the mouse cursor over into the code window.  Press F8 to progressively step thru the code line by line.  As you get into the "action" of the code, you will be able see what each step does and how it impacts your drawing.  Note, after a line of code has executed, you can place the mouse cursor of parts of the line of code to see what their value becomes.

In order to affect the double click behavior, you can right click on a shape and bring up the context window.  Select format > behavior  to get new menu.  Select double-click tab.  Select the Run macro option.  The macro ought to be listed.  (This method is for V2007.  Don't know if it's the same for V2010 or V2013.)  Whatever the process is, you need to do this for each shape to use double-click method.  That's a disadvantage of the double-click approach.  You could also run macro normally thru the Ribbon user interface.

Once you get used to and understand the code (somewhat) then, bring on your questions.  Besides Yacine and myself, there are a lot of regulars who can provide helpful guidance.  Many times, additional eyes spot better ways to do things.

HTH
Wapperdude.
Visio 2019 Pro

novski

  • Full Member
  • ***
  • Posts: 182
Re: Animation (toggle show and hide of connections)
« Reply #22 on: November 27, 2014, 02:35:40 AM »
Hi Yacine,

It's getting close to Christmas! What does this forum cost for a year?
I may donate something because I'm really interested in such a solution and because i really appreciate your (and all the others) work here...

Hi Darren,
there are so many questions in your post, that I don't know where to start.
It is obvious, that you lack the very basics of Visio. (sorry)
What about a generous donation to the forum and we prepare a solution that you can use as it is?
http://www.visguy.com/about/donate/

Best Regards
Novski
« Last Edit: November 27, 2014, 06:33:29 AM by Visio Guy »

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1669
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Animation (toggle show and hide of connections)
« Reply #23 on: November 27, 2014, 06:31:41 AM »
Hi Novski,

The forum is free, and frankly, I don't do much of the work: folks like Paul Herber, JuneTheSecond, Yacine, Vojo, AlEdlund, Wapperdude, Nikolay (sorry for those I've forgotten) answer a TON of questions.

However, I do pay for the webhosting and do all the updating (when Paul H tells me to), so donations are welcome. And I could theoretically buy those guys beer with the proceeds (when they come to Oktoberfest)...which reminds me, I just saw Al in Seattle and didn't buy him a beer!

And you can always send private messages to members asking if they would like to do a bit of custom work on contract if you find yourself over your head or out of time.

Thanks for the generous thought, and good luck finding the information you need!

Chris
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

novski

  • Full Member
  • ***
  • Posts: 182
Re: Animation (toggle show and hide of connections)
« Reply #24 on: November 27, 2014, 11:26:09 AM »
Is it possible to store Macros in to the shapes? So i can pull it in to my page from the if i need it...?

Yacine

  • Hero Member
  • *****
  • Posts: 2643
Re: Animation (toggle show and hide of connections)
« Reply #25 on: November 28, 2014, 01:43:01 PM »
Hi Novski,
no, you can't store macros in shapes.
You can use a stencil that needs to be loaded, or the document itself, but then you need to start from a dedicated template.
The stencil option is better.

Regarding your "package", what are you actually missing?
Yacine

Yacine

  • Hero Member
  • *****
  • Posts: 2643
Re: Animation (toggle show and hide of connections)
« Reply #26 on: November 28, 2014, 01:44:57 PM »
And I could theoretically buy those guys beer ...

I somehow still feel thirsty after all this virtual beer. ;)
« Last Edit: November 28, 2014, 01:46:38 PM by Yacine »
Yacine

vojo

  • Hero Member
  • *****
  • Posts: 1279
Re: Animation (toggle show and hide of connections)
« Reply #27 on: November 30, 2014, 09:05:33 PM »
If you want to show/hide connections, you can do this

1. take the shape
2. make it a group
3 go into shapesheet and down in the type of select section, there is a cell in middle column top that will show/hide connections
   of children shapes
4.can automate with an action

Something like this....right click the blade


Jumpy

  • Hero Member
  • *****
  • Posts: 1061
Re: Animation (toggle show and hide of connections)
« Reply #28 on: December 04, 2014, 12:50:18 PM »
And I could theoretically buy those guys beer ...

I somehow still feel thirsty after all this virtual beer. ;)

He Yacine, compared to some of the other guys here your journey to munich would be a short one.  ;D

Yacine

  • Hero Member
  • *****
  • Posts: 2643
Re: Animation (toggle show and hide of connections)
« Reply #29 on: December 04, 2014, 02:08:04 PM »
Indeed. We could travel together. I'm sure Chris would not mind buying another beer for you too.


Haven't seen you that often lately in the forum. Busy? May be I could buy you a beer in MG?
Yacine