News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Animation (toggle show and hide of connections)

Started by darrenj1471, October 22, 2014, 03:23:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wapperdude

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

@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

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

#18
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.
Visio 2019 Pro

darrenj1471

#19
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)

Yacine

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

QuoteOk 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

#22
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...

Quote from: Yacine on October 27, 2014, 04:28:39 PM
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

Visio Guy

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

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

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

#26
Quote from: Visio Guy on November 27, 2014, 11:31:41 AM
And I could theoretically buy those guys beer ...

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

vojo

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

Quote from: Yacine on November 28, 2014, 06:44:57 PM
Quote from: Visio Guy on November 27, 2014, 11:31:41 AM
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

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

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 423 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1302KB.
Tokens: post-login.
Cache hits: 14: 0.00195s for 26,740 bytes (show)
Cache misses: 4: (show)
Queries used: 17.

[Show Queries]