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

New Shape with Shape Data not working...

Started by Andy the BA, October 18, 2021, 08:07:56 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy the BA

Hi All

I'm a newbie to the forum so first off thanks for having me and apologies if I ask dumb questions!!

As a Business Analyst, I'm experienced with Visio, but I am new to shape sheets and I'm loving some of the clever stuff they can do.  Alas, I have run into a problem which I cannot seem to find an answer to just by searching Google.... (and just for background, although I am a Business Analyst, I can write VBA and have done quite a lot of complex stuff with User Forms in Excel as well as Access Databases with DAO/VBA etc so I'm not completely new to the more "techie" side of Microsoft products)

So, onto my question...
I have built a "Business Capability Model" Custom Stencil which contains some shapes with Shape Data  (see the attachment for a rough idea of what the shapes look like). The shapes have Shape Data items which change the label content of the shapes and the colour of the "blob" depending on whether the capability is "In" or "Out" of a project's scope. The shapes are set up so that they launch the Shape Data dialog when dropped so the user can add the Capability ID, Capability Name and state whether the Capability is In or Out. (Capability in or out controls the fill colour of the blob). There are also some custom menu items on right click of the shape which allow the "blob" can be shown or hidden (some diagrams don't need the blob to reflect in scope or out of scope)

Shape B was basically created by copying Shape A and adding extra functionality to it (I wanted the something extra to represent whether business users already use a capability in current state, so I've added a square as well as the "blob")

Now here is the problem:

Shape B works perfectly in the Stencil, but once the stencil has been saved and closed, dropping that shape into a drawing (any drawing) brings across the shape across, but NONE of its Shape Sheet settings or Shape Data elements.  The shape is available to other drawings when the stencil is opened, but it does not make the intended functionality available to other drawings.  Dragging from the stencil just creates a "dumb" shape rather than an exact copy of the shape and it's functionality

Shape A works perfectly in both the stencil and other drawings.  I'm really not sure what I have missed here as I would have thought if a shape was working in the stencil it would be OK in drawings.  Can anyone advise please???

Many thanks in advance

Andy

Surrogate

Hi, Andy!
Try use user-defined cells sectio for store data in your smart-shapes.

https://flylib.com/books/en/2.268.1.25/1/
In this chapter you can read about advantages of user-defined cells.

Andy the BA

Hi Surrogate

I'm already using user defined cells...

The issue is not with making the capability work - it's all fine in the Stencil. 

The issue is that for Shape A, the stencil's object copies into new diagrams perfectly and behaves as required.
For Shape B, the stencil's object copies into new diagrams as a shape only, with NO shapesheet data and NO shapedata configured...


Any ideas?

Cheers

Andy

Quote from: Surrogate on October 18, 2021, 10:12:17 AM
Hi, Andy!
Try use user-defined cells sectio for store data in your smart-shapes.

https://flylib.com/books/en/2.268.1.25/1/
In this chapter you can read about advantages of user-defined cells.

Surrogate

Quote from: Andy the BA on October 18, 2021, 10:19:43 AMAny ideas?
Unfortunately, I am not a telepath and do not know how to heal from screenshots...

You can share your examples of Shape A and Shape B ?

vojo

Some thoughts
   - Your use of nomenclature is confusing: 
           - A stencil must be open (not necessarily editable) to drop shapes in UI mode.
             (probably could use VBA to do this with stencils closed but I never have done it).
           - Shape B does not inherit Shape A custom properties  (you can copy A and call it B and add some custom props).
   - I assume you are use the eventdrop cell in the shapesheet   
           - eventdrop = docmd(1312) will drop shape and open custom properties UI for that shape
                  - BTW, while complex, you actually can use the invisible cells to make the custom properties UI context sensitive
                    (on drop "pick group a" ==> using user cells, will open only group A custom properties)
                    (Long time ago, I used this approach for blades:  Network, processor, storage groups of custom props)
   - In general, the shape drop flow is as followings
           - from your stencil to the document stencil for this particular drawing
           - from document stencil to the page you are on
           - a shape in drawing X (doc stencil X) is not and can not be used directly in drawing Y (doc stencil Y).
                 - Need to pull from your stencil into doc stencil Y ==> page in drawing Y
                 - updates to the shape in doc stencil are not reflected back to your stencil...1 way from your stencil to doc stencil


Andy the BA

Quote from: Surrogate on October 18, 2021, 12:06:39 PM
Quote from: Andy the BA on October 18, 2021, 10:19:43 AMAny ideas?
Unfortunately, I am not a telepath and do not know how to heal from screenshots...

You can share your examples of Shape A and Shape B ?

A slightly grumpy (and quite unhelpful) response that one Surrogate... The sarcasm and Headbang emoji was a bit unnecessary in my view... Sounds like what I considered simple language for describing the problem is not correct "nomenclature" either... As I mentioned in my OP - I am a newbie!

Anyhow - for reference, and in case anyone is curious, I have fixed the issue without resorting to telepathy or sharing my employer's content to the whole world...  Please forgive any nomenclature issues.

The answer: It was a shape grouping issue - plain and simple...

Shape A was comprised of 3 shapes, all grouped together with the shape sheet / shape data functionality all captured against the group of all 3 shapes. It works fine.

Shape B was comprised of 4 shapes but the additional shape had not been added to the group properly. The shape data / shape sheet functionality was still coded against a shape group of only 3 shapes. Now for the interesting bit... Dragging the shape from the Stencil to a new drawing obviously takes all 4 shapes and drops them as a group into the new diagram. Because the functionality needed was on the group of 3 objects only and not the group of all 4, the "Group" on new diagrams did not have functionality.

The lesson here is:
When doing shape sheet coding, always make sure you've got your shape groups right first, children!

Cheers

Andy

   

Andy the BA

Quote from: vojo on October 18, 2021, 12:54:19 PM
Some thoughts
   - Your use of nomenclature is confusing: 
           - A stencil must be open (not necessarily editable) to drop shapes in UI mode.
             (probably could use VBA to do this with stencils closed but I never have done it).
           - Shape B does not inherit Shape A custom properties  (you can copy A and call it B and add some custom props).
   - I assume you are use the eventdrop cell in the shapesheet   
           - eventdrop = docmd(1312) will drop shape and open custom properties UI for that shape
                  - BTW, while complex, you actually can use the invisible cells to make the custom properties UI context sensitive
                    (on drop "pick group a" ==> using user cells, will open only group A custom properties)
                    (Long time ago, I used this approach for blades:  Network, processor, storage groups of custom props)
   - In general, the shape drop flow is as followings
           - from your stencil to the document stencil for this particular drawing
           - from document stencil to the page you are on
           - a shape in drawing X (doc stencil X) is not and can not be used directly in drawing Y (doc stencil Y).
                 - Need to pull from your stencil into doc stencil Y ==> page in drawing Y
                 - updates to the shape in doc stencil are not reflected back to your stencil...1 way from your stencil to doc stencil

Thanks Vojo - some responses to your thoughts...
Thought 1. Yes - I know that bit.  I have been opening / editing the stencil itself. In fact, it's a stencil I created myself so I know how that bit works. As I've been trying different fixes, I've been closing the stencil, opening a new blank Visio drawing, adding the updated stencil and dropping the shape.  Tedious, but has proved useful...

Thought 2. Yes - I have Event Drop in the shape.  I like the sound of the "context sensitive" bit - I might play with that in future

Thought 3.  That's good to know.  I figured there was some sort of flow to how things go from Stencil to Document to Page - good to have it spelled out

Fortunately, the error is even more "school boy" than any of that!! See my previous post for more!!

Cheers
Andy

Surrogate

#7
Quote from: Andy the BA on October 18, 2021, 01:01:50 PM
The answer: It was a shape grouping issue - plain and simple...

Shape A was comprised of 3 shapes...

Shape B was comprised of 4 shapes...
You sure that all peoples can understand it, just looked to your screenshot ?

Quote from: Andy the BA on October 18, 2021, 01:01:50 PM
sharing my employer's content to the whole world...
Excellent! Russian hackers will not recognize your employer's top-secret content consisting of 3-4 shapes, which was stored in shape A!  ;)

wapperdude

Hi Andy...
Good news you have resolved your problem.  Sorry you felt some responses were off-putting.  All of the forum volunteers try very very hard to provide useful and respectful answers.  Occasionally, with humor.  This time the humor came across wrong.

Your initial description was quite vague, while your concluding statement provided much useful detail...grouped shapes, various elements of the shapesheet you used.  All of that would have been easily recognizable had you uploaded sample shapes.  Company specific info could have been eliminated / replaced with bogus info, and still allow us to see how the shapes were structured.  The shapesheet is very powerful and complex.  Solutions typically are uniquely specific.  That's why uploads are so beneficial.  It provides with the needed visibility to enable us to offer useful solutions/recommendations... we need to see the details.

Again, happy that your project is working and moving forward. 
Wapperdude
Visio 2019 Pro

Paul Herber

You do need to attach the shape in the stencil. We can't fix it otherwise.
It's quite likely that your stencil shape consists of more than one shape so when dropped on the page the shapes become grouped, that will stop things working as you expect.
Electronic and Electrical engineering, business and software stencils for Visio -

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

Andy the BA

@Paul Herber - Thank you. That was exactly the problem.

@wapperdude - Thank you too for replying.
In my OP, I was trying communicate the problem as succinctly as possible without forcing people into the detail.

All I was really expecting was some insight about whether there was a common list of "things to check" in the circumstances I described.  I was not expecting anyone to actually fix my work for me or to spend time looking in detail for solutions. I was expecting what I saw from Paul in his last post. I was expecting a response more akin to "if shape's not working as expected - try this" rather than being pulled up for not giving enough detail. I was expecting the generic rather than the specific ...  Sounds like my expectations are out of alignment here.

Now I've got a better handle on what the forum needs, I'm sure I'll be better prepared next time!



Paul Herber

Trouble is that the generic is oftem not very useful in these cases ...

Problem: My car keeps crashing.
Fix: Please drive your car in such a way that it doesn't crash.
Electronic and Electrical engineering, business and software stencils for Visio -

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

Andy the BA

Indeed Paul, BUT: 

Q: "My shape doesn't work when dragged onto the document"
A: "Have you checked to see if it's grouped properly?"

would have done the job....

I'm checking out on this thread now.  I've solved the issue - time to move on...

Cheers

Andy

vojo

I think you are missing my point

you have.....Group A:   3 shapes with custom properties at the group level
you want.....Group B:   4 shapes wiht custom properties at the group level

So if you copy group A to B  (copy paste)....B now has 3 shapes with same custom props field as A
    (you can change B custom prop vailues in the fields and group A values remain as before).
Now if you ungroup because want to regroup with 4th shape, you lose all the custom properties since group disappears
    ( what you want to do is go to behavior of group B and select add on drop....go to shape 4 and select add on drop)
    (then drag shape 4 over group B....should see a hash pattern....that means shape 4 is now part of group B)
    (from there you can add additional custom proprietes to group B custom properties...original group A fields still there).

Andy the BA

OK Vojo...

This is how the whole thing has come about (and it's now fixed so we can all move on!!  :D )

In the Stencil
I had Group A: 3 shapes with custom properties at the group level all working properly. I needed to add an additional capability to it.

I copied Group A to create Group B:
I added an additional shape, added additional code to the Shape Sheet for the existing Group for the behaviour I wanted the new shape to have.  I had not noticed the fact that I'd not added the extra shape into the Group at that point. A small oversight which has caused a plethora of forum posts and much cursing at my Visio screen.  Right clicking the group in the Stencil showed all functionality working as expected but this is because I was right clicking the GROUP to test it, not the additional shape.

In any drawings using my custom stencil
Dragging the shape from the stencil to the drawing was bringing the whole thing across as a group of 4 within the drawing. The DoCmd to launch the Shape Data on Drop was not working, nor was there any shape data of functionality on the shape at all.  Reason: Because dragging from the stencil was bringing across a group of 4 (which has no code) as opposed to the group of 3 (which did have code!) + 1 independent shape

Solution:
Back into the Stencil, open the shape for editing, select the Group, Plus the additional shape not included, Click Group > Add to Group.  All code in the shape sheet now attached the group of 4, not the group of 3. Everything fixed.. Simples. 

I have learned today that a lack of detail on this forum is construed rather negatively.. Hopefully this is specific enough and indication of a problem solved!! :D

Cheers

Andy

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: 508 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1303KB.
Tokens: post-login.
Cache hits: 15: 0.00178s for 26,733 bytes (show)
Cache misses: 4: (show)
Queries used: 15.

[Show Queries]