Wierd ShapeSheet FillForegnd behaviour

Started by AJD, January 05, 2018, 12:24:30 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wapperdude

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
Visio 2019 Pro

wapperdude

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
Visio 2019 Pro

vojo

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.

AJD

Wapperdude, et al: I tried the change and it had the desired result. However, I note vojo's addition.

Wapperdude :

  • I was not being stubborn, I was being aware of realistic constraints - I don't have three days to try different variations of cut and paste just to see what works (I was moving a lot of information). As a work flow, copying the diagrams into the new file and then spending the thinking time about what needs to be trimmed in the first instance is the most efficient way to do it.
  • In hindsight, trying different ways to cut and paste would not have made any difference to my confusion - I could never have narrowed it down to the "SETF" issue. This is not wishful thinking, it is based on experience in testing and fault finding over many years.
In the interest of continuing to learn:

  • I have had a search on the internet. I can find plenty of articles telling me how to use SETF, but not any saying "when". Why would linking to a User.X with a formula not work (sometimes) while linking to User.Y without a formula work more consistently? Especially as I have been using this construct for a while without any (obvious) problems.
  • In addition, if the lack of SETF is such a problem, why did the original file work? And why did the Dependency line style which uses a similar function continue to work as expected?

Thanks.

wapperdude

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

AJD

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

vojo

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.

wapperdude

@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
Visio 2019 Pro

vojo

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.

wapperdude

@Vojo:  Yes, I vaguely recall a post like that...Will have to refresh my memory.  😕
Visio 2019 Pro