Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: AJD on January 05, 2018, 12:24:30 AM

Title: Wierd ShapeSheet FillForegnd behaviour
Post by: AJD on January 05, 2018, 12:24:30 AM
I have a work related problem and, as such, I cannot attach the example file. I have tried to duplicate the issue in a new file on a different system (so that I could get an uploadable example), but was not successful.

I had a working dynamic shape in the original file (multiple diagrams, but the shape in question was only on one diagram). I copied the relevant drawing (Ctrl-A, Ctrl-C, Ctrl-V) from that file into a new file (I had multiple drawings from three files that I wanted to collate into a new file). For work-related reasons, I cannot use the original file.

I use dynamic shapes as part of a diagram, where the user can change the shape data (i.e. change a category) and the shape will change colour. The mechanics for this are in the ShapeSheet.

The key piece of data (Prop.Category) is an index from a fixed list of options. A User field (User.ForeColour) uses the Prop.Category data to determine the RGB colour value from another fixed list (another index/lookup formula). I have FillForegnd set to access User.ForeColour directly.

In my example here, the user selects Prop.Category #3, which indirectly sets User.ForeColour to RGB(128,0,128). However, in my current file setup, the FillForegnd is then set to RGB(64,86,150). When I select other categories the FillForegnd values are also changed from the expected value.

I have checked the ShapeSheet using both the formula and values view. Everything is correct (except for the final value in FillForegnd). Double checking User.ForeColour shows that it holds the value RGB(128,0,128) as expected.

Interestingly, if I overwrite the formula in User.ForeColour with the static value RGB(128,0,128), FillForegnd is correctly populated and the shape shows the correct colour. Return to the formula (which still ends up at the right value) and the FillForegnd is again populated with the wrong RGB value.

I have checked and removed themes, this has had no effect.

Visio 2010, Networked Windows 7 environment. The file with the original master shape still works as expected. The new file with the copied shapes (and by default, the copied master) is the one with problems. I have double checked the ShapeSheet and the default/master settings are as expected (black text) and the tailored choices (blue text) are as expected.

I don't know where else to look to see if anything has changed. Any hints on why it may be doing this, or anyone else noticing the same behaviour would be greatly appreciated. As noted above, I have not been able to replicate this on another system so I can post an example here. It can't be system related if one file works and the other doesn't.
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: vojo on January 05, 2018, 02:27:52 PM
fillforegnd = guard(user.forecolore)
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: AJD on January 08, 2018, 06:26:41 AM
I tried adding the GUARD condition, but no change to what was happening.

I did a comparison with the original file. I dropped the same master onto the page and did a line-by-line comparison of the shapesheet. Apart from the X-Y location (to be expected) and the addition of GUARD() , no difference in the shapesheets. The old file worked as expected, the new file did not. Both files are in the same folder.

I have also checked the document shapesheet. The new file has visTLSShowProps, visTLSShowPropsOn, visTLSShowPropsOff, as additional User.Properties, but these would be related to another diagram in the document. Likewise, no significant difference in the Page shapesheet.

I have checked the layer properties (in case I had some funky transparency thing), but all is normal there. While I have some VBA in the background of both files, there are no differences there (none of the modules make changes to that diagram and they are not autorun/event driven).

I have created a test file on that network (using "save as"). I have removed all extraneous sheets and VBA. No difference.  I removed the TLSShowProps items, no difference.

I have modified one of the dropped shapes with two additional derived data elements: one that shows User.Activity_ForeColour, and one that shows FillForeGnd. Remembering that FillForegnd is now set in formula to " =GUARD(User.Activity_ForeColour) ".

I have run through the various values (RGB), these are actual numbers I have taken from the dropped shape.

What it should be (as set in User.Activity_ForeColour) ..|.. What is set in FillForegnd 
0,0,1280,0,153
0,128,00,128,0
0,0,22064,86,150
128,0,12864,86,150
200,0,20064,86,150
200,200,0163,163,0
50,50,5084,95,46
255,255,255255,255,255

Don't what else to try or where else to look to get hints on what is happening.

Still don't have example files that I can copy to here - network policy issues.


Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: Yacine on January 08, 2018, 10:04:29 AM
Diagnosis without shape VERY difficult.
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: vojo on January 08, 2018, 02:06:45 PM
Well...I do that all the time

See enclosed (built in 2003 context...probably 10 years ago)
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: AJD on January 09, 2018, 06:37:49 PM
Quote from: Yacine on January 08, 2018, 10:04:29 AM
Diagnosis without shape VERY difficult.

I agree and apologise, but organisational policies are what I am trying to navigate. I am still hoping to get my example files through.
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: wapperdude on January 09, 2018, 07:57:30 PM
Can you make a dumby-downed version, with no proprietary info?

Wapperdude
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: AJD on January 10, 2018, 05:20:43 AM
Quote from: wapperdude on January 09, 2018, 07:57:30 PM
Can you make a dumby-downed version, with no proprietary info?

Wapperdude

I have now created the dumbed down versions but still need to navigate system and organisational policies to get these off the network.  Understandable from where I am sitting, but probably sounds weird to most forum visitors.

The dumbed down versions still exhibit the behaviours I have described. If/when I get them off the system, I won't be able to double check the behaviours (I don't have Visio on my home system ... yet) so would be posting them in blind faith.

In the meantime, I can still be eyes and ears if anyone has any ideas and wants me to check something that I have not already checked/explained.
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: wapperdude on January 10, 2018, 06:18:42 AM
Perhaps you could try this.  Duplicate your working file and verify it still works.  Then, instead of copying what you need, start removing what you don't need.  Verify that all is well as you remove stuff.  You might find a breaking point, or you might be successful in your trimming efforts.  This would at least prove whether or not the elements you want maintain integrity.

If all is well, then you can either copy / paste into new file or, starting adding stuff into this file.  The thing with copy / paste, if you don't do it all at once, some links might be broken.

Your description seems to indicate that a lot of steps have been performed, and somewhere, something broke.  You need to go back and see if you can isolate the problem step.

Wapperdude
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: AJD on January 10, 2018, 07:24:17 PM
Quote from: wapperdude on January 10, 2018, 06:18:42 AM
Perhaps you could try this.  Duplicate your working file and verify it still works.  Then, instead of copying what you need, start removing what you don't need.  Verify that all is well as you remove stuff.  You might find a breaking point, or you might be successful in your trimming efforts.  This would at least prove whether or not the elements you want maintain integrity.

If all is well, then you can either copy / paste into new file or, starting adding stuff into this file.  The thing with copy / paste, if you don't do it all at once, some links might be broken.

Your description seems to indicate that a lot of steps have been performed, and somewhere, something broke.  You need to go back and see if you can isolate the problem step.

Wapperdude

I have already created new versions of each file and removed all stuff not required (including all macros) so that each file is now a single page with only a few shapes on it.  No change in behaviours (which should indicate something).

The only thing that I did in the original  process (which seems to have broken something) is to copy some shapes from one file into another file. I copied from page to page (i.e. Ctrl-A, Ctrl-C, Ctrl-V). The problem is not unique to the shapes I have in my test page, I have another set of shapes in the stencil that are exhibiting the same behaviour (the underlying shapesheet formulas are similar) - buy I figured that if I can solve this for these shapes I will have an answer that I can use to check the whole file.
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: wapperdude on January 10, 2018, 08:09:03 PM
Seems like your method is correct.  It's good that the stripped down files are functioning properly.

When you paste, does everything go onto same page?  That ought to work.  Perhaps for trouble shooting, copy paste from one file, verify still works.  Create a 2nd page, copy paste from next file.  Verify that both pages still work.  If so, do third page and 3rd file.  Again, verify everything still works.  Then, copy from 2nd page and paste onto 1st.  Verify everything on 1st page still works.  Repeat for 3rd page.  Theoretically, one of the steps probably causes a problem....that should simplify trouble shooting.

Wapperdude
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: AJD on January 11, 2018, 05:15:15 AM
Quote from: wapperdude on January 10, 2018, 08:09:03 PM
Seems like your method is correct.  It's good that the stripped down files are functioning properly.
[...]


Apologise if we are at cross-communications. The stripped down files are behaving as before - one works, one does not. When I pasted, it was page-for-page (Visio 2010 - couldn't just copy a page from one file to another like in Excel!).

I have now navigated our internal processes and I have two files for comparison. My caveat here is that I could not open the files in Vision on my system simply because I do not have Visio. I opened the files and the default viewer is Internet Explorer and I could still see a colour difference.

OK, slight issue - one file size is still 580KB - didn't realise the file size limitations on this forum.
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: wapperdude on January 11, 2018, 06:44:27 AM
Yeah.  I think we're still not on the same page.  My understanding was you copied relevant pieces from  3 files to make the new file, and the new file does not work.  But, for the method I outlined, the number of original files is not important.

For the moment, forget about your non-working new file.  We're going to ignore it.

Take your 1st, working file and duplicate it.  Everything should still work with the duplicate file, yes?  Now, with this duplicate file, start removing what you don't need....shapes, macros, pages...until you get down to just what you want.  Do this in stages, not everything at once.  At each step, you should verify that your dynamic shape still works.  If not, you've identified where to look for the problem and should be able to make corrections.  Eventually, all you should have left is working, and is identical to what you want copied into that "old" new master file.

Now, do this for your other files.  You should have 3 stripped down "duplicate", working files.  Now, you can start creating your new master file as previously discussed.  If all goes well, the new file should work as desired.  Now, throw away that faulty, non-working, new file.

Wapperdude
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: AJD on January 11, 2018, 06:53:26 PM
I have managed to trim the files down to the post-acceptable size. The non-working file is attached to this post, the working example will be attached to the next post.

@wapperdude: Yes, I could try different ways of copying shapes from one file to another. But at the time what I did was right (and I would still consider it to be right based on what Microsoft says should work). Rather then spend a couple of days trimming and reworking files, I just recognise that I have a curly problem here - one that has persisted multiple file edits, saves and transfers. And I can see no visible reason why this problem exists. Even if a repeat does cause the same error, I will be in the same position now - no logical reason why the error is occurring.
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: AJD on January 11, 2018, 06:54:47 PM
The working example. When I loaded the files on an old laptop (where I have Visio), the problem still existed. Note the difference in colours for the shapes - they should be identical.
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: wapperdude on January 11, 2018, 10:17:21 PM
Well, you can be as stubborn as you wish.  The point was to find where / how the problem is created.  Wishful thinking won't change anything.

Wapperdude
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: wapperdude on January 11, 2018, 10:37:14 PM
Well, the solution was easy.  The FillForeGnd cell is referencing the User.Activity_ForeColour cell.  That cell has a formula,  The FillForeGnd cell doesn't accept that as valid.

Simple correction:  change the formula, so that the desired value is pushed into the FFG cell.  The working formula would be:  =SETF(GetRef(FillForegnd),INDEX(LOOKUP(Prop.Domain,Prop.Domain.Format),User.DomainColourChoices))

Works with the change using SETF function.
Wapperdude
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: vojo on January 12, 2018, 05:13:26 AM
well got to be careful

Formula cited works great (push value into) IF no user will ever try to set color manual (if he did, it will overwrite foregnd cell)

Better off using SETF to set another user.cell....then use fillforegnd = guard(<another user.cell>)   This will protect the selected
color from user changes.  e.g. (a protected form of pull value from)

if you want to use the policy menu, then should experiment with preventing formatting.  I have had problems at times
where this ONLY protects formatting of top/group shape not subshapes.
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: AJD on January 12, 2018, 05:40:42 AM
Wapperdude, et al: I tried the change and it had the desired result. However, I note vojo's addition.

Wapperdude :
In the interest of continuing to learn:

Thanks.
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: wapperdude on January 12, 2018, 06:05:20 AM
My apologies.  I was hoping to lead you down a path to get hands-on experience with potential complexities and trouble shooting technique.

Vojo is correct that manual setting can clobber the color.  But, it can still be solved with formula,  the following works:  =SETF(GetRef(FillForegnd),"GUARD(INDEX(LOOKUP(Prop.Domain,Prop.Domain.Format),User.DomainColourChoices))").  No extra cell needed.  At any rate, two solutions.

Also, unless it's a desired feature, you do need to add a Guard() wrapper around the background color.  Otherwise, user can also change that.

Why it worked sometimes and not others...no idea.

Basically, SETF will force write to a cell, including over-writing a guarded formula.  But, it only writes when activated.  That's why user intervention would change the color until shapedata was re-used.  With the formula change, the Guard protects the contents from direct user GUI changes.  Yes, it's a formula, and yes it's working in this case.  No, I can't explain it.  So, Vojo's approach might be more reliable, predictable.

Finally, in the shapesheet Events section, you might want to add DOCMD(1312).  Double clicking the shape will bring up the shapedata menu.

Wapperdude
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: AJD on January 12, 2018, 06:24:59 AM
Wapperdude: agree, I don't use GUARD enough and is a habit I should get into. Interestingly I added DOCOMD(1312) to one of my other shapes yesterday as a perfect fit for what I wanted to do.


For information: solutions transferred to where I originally asked the question: https://superuser.com/questions/1277331/fillforegnd-in-shapesheet-using-wrong-data/1284791#1284791
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: vojo on January 12, 2018, 02:14:26 PM
RE DoCMD(1312).

Pre 2013:   Works great!!!!!!!!!!  I use it a lot

post 2013:   Well, it got mucked up by MS.   I believe its #3 of the 10 things 2013 broke in Visio.

                  Basically if the shape is at the top level of drawing
                  (a statement of the shape being the first shape selected when group selected), the docmd(1312) will not
                  open the dialogue...instead it would open one of those properties windows.   If the shape is lower (subshape in
                  a group) it will work fine
             
                  RE containers:  I never found the reason for creating those...so never use them....don't know docmd behavior
                                         in a container.
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: wapperdude on January 12, 2018, 03:58:52 PM
@Vojo...really???  Since I stopped updating with V2007, no direct experience, but I don't recall seeing anything on the forum about this.  Don't recall anyone pushing back at me, until now.  That's a nice feature, would've thought M$ had corrected it. 

Containers are different, but M$ made some nice object model updates.  Our might want to explore a little more.  Definitely strike me as a valuable new feature....but, don't really know for sure.

Cheers.
Wapperdude
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: vojo on January 12, 2018, 09:40:52 PM
oh yes happens to me with 2003 shapes in 2013.

look for entries from me with something like "top 10 steps backward with 2013 from 2003"..if I remember correctly

lists include
- doesn't save session settings like mm vs inches...have to use template
- props menu behavior
- default to refs (refline vs line)...ref points different so have to change base shape before changing formulas
- 3D transforms are based on euler (so virtual gimble lock) vs quadrarians (no gimble locks).
- etc.
Title: Re: Wierd ShapeSheet FillForegnd behaviour
Post by: wapperdude on January 12, 2018, 10:13:42 PM
@Vojo:  Yes, I vaguely recall a post like that...Will have to refresh my memory.  😕