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

A challenge: PageSheet cell changes don't trigger Shape Data window changes

Started by scott, July 15, 2020, 08:20:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


I have a challenge for the folks on this forum!

In the attached diagram, the rectangle and the page contain identical User and Prop cells. The goal is to show/hide Prop A, B, and C by using a formula in the Invisible cell for A, B, and C. Toggling the value in "Show/Hide All" should do the trick. (I'm sure many of you have done this!)

It works fine for the shape.

However, when you select the page and attempt to do the same thing, the visibility of the Prop cells in the Shape Data window does not change – despite the fact that the values in the Invisible cells in the page's ShapeSheet do change. To say that another way: The ShapeSheet is correct after the user's change but the Shape Data window does not refresh.

I found one (very clumsy) workaround: After changing "Show/Hide All" for the page, enter and then exit any cell in the ShapeSheet – no need to make any changes, just enter and exit a cell.

Visio Guy found another (less awkward) workaround: Change "Show/Hide All" for the page, click a shape, and then click back to the page.

I've reported this as a bug, but in the meantime, the challenge is this: can anyone find a ShapeSheet formula, or combination of formulae, that forces the Shape Data window to update after the user makes a change? I've tried a couple of SETF and SETATREF combinations but haven't found one that forces the Shape Data window to update.



so to recap, you want to show/hide ALL shapes on a page or even hide the page.
that is somewhat unusual.

More common is to want to show / hide a group shape or a child shape

for a group
- set the control at group level...maybe actions (note, to get it back, use lasso then right click).
     sheet.1!actions.s_h = setf(getref(actions.s_h.checked),if(actions.s_h.checked,0,1))
- in each geometry at group use the checked cell
     sheet.1!geometry<n>.showhide = if (not(sheet.1!actions.s_h.checked),0,1)
- in child shape geometries
     sheet.99!geometry<n>.showhide = if(not(sheet.1!actions.s_h.checked),0,1)

There are more complicate ways to do this using setatref functions in width and height
if actions checked, then width =0mm height =0mm...if not their values
Setatref will allow you to change width and height ....and store elsewhere to allow you to retried late
complicated and subtle.


I don't want to show/hide all the shapes on the page!

The example file I provided is just to show the difference in behavior after changing a Shape Data value that results in the need to update the Shape Data window -- it works correctly for the shape but it fails for the page.

Sorry if show/hide was misleading. Hiding Shape Data rows was merely an example of something that requires updating the Shape Data window after the user makes a change. If you'd like a different example, just let me know.

As I said in my initial post, I'm sure this is a bug in Visio. I'm hoping for a creative workaround -- perhaps a formula that forces Visio to update the window.

Sorry for the confusion. Does this make it more clear? Or worse? ;-)


You can try to shake Shape Data Window.
For example, like this:

I liked your challenge :)


Very challenging indeed.

I found out that the cells trigger just fine, it's the display which does not refresh.
When you select any shape after having modified the page prop and desellect again, the props display as they should.

A macro could do the selection job, but I guess you want a pure shapesheet solution.


Presumably, the Data Window is protected from external events while the changes caused by the action in this window are taking place. Therefore, the data changes, but the window does not feel it. And then it gets late.
Deferred push is fired. For example, the NOW () function updates the window. But it fires once a minute.

A timer or VisioIsIdle would be very helpful in this case. But they are missing from the ShapeSheet.
Oh, I came up with... It is needed to make a little Add-on that will execute the timer function and return the result to the ShapeSheet.


Thanks everyone for your thoughts.

And a special thanks to @Croc: closing and reopening the Shape Data window is the answer! Clearly that shouldn't be necessary -- and isn't necessary when using the exact same formula for the shape on the page -- but close/reopen does force Visio to refresh the Shape Data window.

BTW, for those of you who asked, yes, I know I could solve the problem with code but I was looking for a ShapeSsheet-only solution.


Changing the selection of the drawing window is easier than closing and reopening the shape data window.
:o ;)


@Yacine: It's true that changing the selection in the drawing window is easier... but I don't know of a way to do that from the ShapeSheet. For this particular solution, I need a ShapeSheet-only method.


For fun's sake, I tested how the Add-on would work :)
Didn't bother with the timer, but just made an entry in the Documents "User.Timer" cell after a short delay.
Here is the Add-on text.
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub Main()
    Dim CmdLine As String
On Error GoTo Main_Err
    CmdLine = Command$
    Sleep 200
Dim appVisio As Visio.Application
Set appVisio = GetObject(, "Visio.Application")
    appVisio.Documents(1).DocumentSheet.Cells("User.Timer").Formula = "1"
    Set appVisio = Nothing
    Exit Sub
    MsgBox Err.Description & "Err1"
End Sub

DEPENDSON (User.HideAll) is used to run the Add-on

It works.
Don't criticize the quality of my code. I just wanted to make sure this approach works.

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: 313 (show)
Files included: 32 - 1207KB. (show)
Memory used: 1180KB.
Tokens: post-login.
Cache hits: 13: 0.00151s for 26,766 bytes (show)
Cache misses: 2: (show)
Queries used: 15.

[Show Queries]