Bug: ShapeSheet Protection values not getting recalculated properl

J

John Beyer

(My apologies if this defect has already been reported and addressed.)

Problem: The cell values displayed in the shapesheet's Protection section
for a shape can get out of sync with the formulas in those cells.

Products: Visio 2003, Visio 2007 Beta2 (I haven't checked earlier versions.)

Scenario:
1. Start up Visio; make sure it's running in developer mode in the
Tools->Options... Advanced tab. You may also want to uncheck the "Open each
ShapeSheet in the same window" option.

2. Open a new diagram (a Basic Diagram is fine) and draw a simple shape on
it (a rectangle is fine). Open the Drawing Explorer window.

3. Use the Format->Define Styles... dialog to create a new style named
TestStyle that is based on "No Style". In the Includes section, uncheck the
Text and Line options, leaving only the Fill attributes option. Click on
Fill... to edit the style's Fill attributes. Change some of the fill settings
to some distinctive fill color and pattern, and click OK.

4. In the Drawing Explorer, select the new TestStyle and open its
shapesheet. In the style's shapesheet, scroll to the Protection section and
manually change all of the Protection cell formulas (except LockDelete,
LockSelect, and LockFormat) to "1".

5. Select the shape on the diagram and open its shapesheet. Open the Style
dialog using Format->Style..., and set the shape's Fill style to TestStyle.
(Leave "Preserve local formatting" unchecked when applying the style.) The
shape's fill will change to the color/pattern you defined for TestStyle. In
the shape's shapesheet, scroll to the Protection section, and note that the
corresponding Lock properties have also been set. (This is, as far as I know,
an undocumented feature; the Protection locks in a style are treated as Fill
attributes.)

6. Select the shape again if necessary and change its Fill style back to
Basic. In the shape's shapesheet, note that the shape's protection locks have
been returned to their original values (i.e., "0") as expected. So far, so
good.

7. Re-apply TestStyle to the shape's fill style to change its fill and
protection locks again. With the shape selected, open the
Format->Protection... dialog. Click on "None" to clear the selections in the
dialog, and click OK. Note in the shape's shapesheet that the corresponding
Lock properties have been set back to zero, and are now colored blue to
indicate local formulas.

8. In the shape's shapesheet, select each Lock cell with a local (blue)
formula and clear the value (hit Backspace twice, then Enter or an arrow
key). Note that these Lock formulas are now set to match those in TestStyle,
and that the shape's behavior is constrained appropriately.

9. Re-apply the Basic style as the shape's Fill style. The shape's fill will
change back to the Basic values. Open the Format->Protection dialog for the
shape; note that the Lock flags have NOT been cleared (!) and that the shape
is still constrained by the locks. However, the shape's shapesheet will show
the shape's Protection cell formulas as 0's (i.e., equal to the values in the
Basic style). Switch to the "Values" view for the shapesheet; note that the
actual values being used do not match the constant formulas from the Basic
style, even though the formulas are being shown as non-local (black). It is
apparent that the Protection lock values are not now being recalculated to
match the style formulas. This is inconsistent with the behavior in Step 5
(above), in which lock values did stay in sync.

10. Click on each Protection cell and clear its formulas again (as in Step
8). Note that the lock value for that cell is now recalculated. (However, if
we re-apply TestStyle, the lock values will fall out of sync again.)

Admittedly, this is a rather convoluted scenario that ordinary users are
unlikely to see. Nevertheless, this should be corrected so Visio geeks like
me don't go crazy trying to use this "hidden" feature.

Has anyone else seen or heard of this behavior?
 
M

Mark Nelson [MS]

Hi John,

Basically the issue has to do with the difference between Style Shapesheets
and Shape Shapesheets. Technically, Visio only uses the formatting sections
of the Shapesheet to define a style. There are a lot of places where other
parts of the style's Shapesheet work, but as you have found there are still
a few places where Visio does not pay attention to these other sections.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

John Beyer

Mark,

Are you saying that the behavior I described is by design?

I would assert that if Visio is supposed to use only formatting sections to
define a style, then propagating the formula in a non-formatting cell (such
as a lock cell) from the style to a shape under ANY circumstances constitutes
a defect.

It may be useful for a style to propagate certain non-formatting cell
formulas to shapes on which it is applied. If that is indeed what you want,
then that behavior MUST be documented.

In any case, I would STRONGLY recommend that the Visio SDK documentation be
updated to describe *exactly* which cells or sections of cells are propagated
when a style is applied to a shape.
 
M

Mark Nelson [MS]

My guess is that this used to be by design but is now considered a bug. I
have seen several changes over time where distinct objects become more and
more similar until they work in new ways. When objects start participating
in new scenarios, there are lots of assumptions in the code that get
challenged. This leads to issues like the one you report here.

A good example of this is the Group object and the Shape object. Groups
started out as containers of shapes. Group objects were distinct from Shape
objects. They didn't support geometry or text and didn't work like shapes
did in a number of circumstances. In Visio 5.0, groups were made equivalent
to shapes. Literally groups are now shapes that can also contain other
shapes. Since that change we have discovered and fixed a number of "bugs"
that resulted from the shift in Visio 5. Any code that assumed groups were
not shapes had to be changed. Even in Visio 2007 we are cleaning up some of
the last remnants of the shift.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top