Controlling visibility of Shape Data

Started by Michelle, June 08, 2012, 07:17:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Michelle

I am have some Shape Data on the main page of a visio template I am working on.  This Data will control shapes on the page.  I can't seem to get the Shape Data to work the way I want it to, though.  I have some Shape Data items that I only want visible if the user chooses "yes" to a previous Shape Data item.  I previously had this working perfectly when the Shape Data was in the shape, but I have a need to have the Shape Data on the Page so it opens up when the users open the template.  (previously the users had to click on the shape to open up the shape Data.) 

Why does this seem to be functioning differently just because the Shape Data is on the page?  (I hope I am making sense... please feel free to ask for clarification if I am confusing things!)

In the attachment, you can see the row for Prop.HVAC.  Ideally, I don't want the user to even see the next two Shape Data Items (Prop.HVACLeftRight1 & Prop.HVACFrontBack1) unless they choose "yes" for Prop.HVAC.  The default for HVAC would be "no", with a pull down allowing users to select "Yes" if they desire.  This was working fine when the SHape Data was in the shape, and not on the sheet... you could see the additional Shape Data items pop right into visibility when "Yes" was selected.  But this SHape Data (which has identical text in the formulas) does not do that.... Help!

Thanks for looking!
Michelle

Jumpy

The brackets () arround the "No" are not neccessary, but beside that I can't see, why it shouldn't work.

Can you see, if it works in the ShapeSheet and only is not displayed in the GUI, or doesn't it work in the ShapeSheet either (switch from formula view to value view to check that)?

Michelle

Strange, now I'm REALLY confused!   :o
I did as you suggested, Jumpy, and changed to values view to see what happened when I used the shape data.  The value chnages appropriately in the shape sheet.  When I change one Shape Data value to "yes", the corresponding Shape Data rows automatically change from "True" to "False".  Only, they don't actually show up in the Shape Data! 

If I go into the Shape Sheet and type in "false" myself,  the proper rows appear in the shape data. But if I put the formula back in, they won't.  Grrrr!  I'm lost!

Michelle

Jumpy

Don't know why that happens, realy strange. You may try the formula:
=STRSAME(Prop.HVAC,"No")

Because the result of that formula is either True or False and that are already the values needed in that field :-)

Michelle

Thanks... This is same as the other formula.  Works in the shapesheet, but the Shape Data doesn't change.  (values change, but no effect in Shape Data window)

Is there a setting somewhere that needs changed? 

Really silly question.  These shape data questions are going to be controlling variable of a shape on the page.  I have yet to go into the shape itself and change the Sub-shapes so they are controlled by this Shape Data on the Main page.  That wouldn't affect how the Shape Data works, would it?  It shouldn't matter that the shape itself is not tied to the data yet, right?  I ask because if I click on the shape, the Shape Data still attached to the shape works correctly, so I wonder ......

Jumpy

One question: With ShapeData-Window - do you realy mean the ShapeData-Window or do you mean the ShapeData-Dialog? Because in the Window the changes should be directly visible,  the dialog must be closed and opened again, for the changes to take effect?

Perhaps you could post a simplified version of your .vsd so others can try to reproduce the problem.

Michelle

I believe I mean Shape Data Window.  This shape has too much Shape Data to all be visible in the pop up dialog! (Due to limits in how many lines will show...)  ;)

I have a Shape Data Window Docked on the left side of my screen, which always shows the Shape Data (if any) for the active or sleected shape, or for the page if no shape is selected.  It works when the shape is selected, but the Shape Data within the Page does not work the same. 

I will work on creating something simple to re-create the issue within a smaller size so I can post it.
Thanks!

Michelle

Michelle

Here's a super simple example of what's happening.  All I have here is a sheet and the Shape Data on it.  There's no shape on this one, but hopefully I can figure out this issue and use the info to control the shape on the main page of my project...

In this attachment, if you change the first Shape Sheet variable from yes to no, the next three options (for leftright, frontback & floorceiling) should dissapear in the Shape Data window. But, of course, they do not.  The Value in the Invisible cell of the shape sheet *does* change properly from true to false, but the shape Data window does not change. 

Any help is much appreciated! 
Michelle

aledlund

The ShapeData-Dialog (the one you get after right-clicking a shape and selecting Data=>ShapeData) is not manipulatable. The Dialog is created via internal code.  The alternative is to write your own Dialog (really a windows form).
al

Michelle

I know the Shape Data found when I right click and select Shape Data will not change... it also has limits to how many lines of Shape Data it will show.  My shape has too much Shape Data to fit within the line limits, so I always use the Shape Data window that you open by clicking View --> Shape Data Window.  I have this window docked so whenever I click on anything with Shape Data, I can see it in the window.  This Shape Data window is dynamic... I had it working when the Shape Data was within the shape itself.  But when I tried to have Shape Dat within the page itself, for somereason the dynamic nature of the Shape Data window does not work....  :( 

I'm going to add a shape to the drawing I attched to my last posting and see if Shape Data in the shape works again... leading me to believe it's just something to do with the page.

Michelle

Michelle

So unhappy!  :(  I added a shape and created the same Shape Data on it to see how it would work...
And it works perfectly.  If you choose "No" for the first item in the Shape Data, the next three disappear.  If you Choose "Yes", they come back. 

I know it sounds trivial, but I have had end users not able to figure out the idea of clicking on the shape to "activate" it so they can enter their info into the Shape Data.  Which is why I was trying to put the Shape Data on the Page instead.  That way when the end user opened the drawing, the Shape Data would already be active.  Right now I have the drawing set so that when the user opens the drawing, the shape they are supposed to control with the Shape Data is partially obscured with a large yellow box that has directions on it telling them to click on the shape to activate it.  Then they are to double click the yellow box to make it disappear.  I still get a few who can't figure out the click on the shape part, or some who never bother to double click to remove the box! (Which makes it impossible for other departments to read the drawing.)  I know it's impossible to idiot proof the project completely, but if I could have the page open with the Shape Data ready to be inputted with info, I'd be a happy camper...

Jumpy

OK, I see the problem now, but can't explain it :-)

Works with shapes but not with page, so I guess it has to do with the internal workings of the update mechanism.
If you make changes, then click on a shape, than click back on the page again, the window will be updated.

So I try to suggest some idea's for workarrounds.
1)
You could try to force the update: Make a new user defined cell that looks at the cells that contain the visibility:
User.ForceUpdate =Dependson(Prop.HVAK)+Callthis("MyMacro")
MyMacro is a VBA-Macro that selects one shape on the page and than deselects all shapes. Maybe that triggers the update of the ShapeData-Window (diddn't try it out). Could be sth. like:

Sub MyMacro()
  Dim pg as Page
  Set pg=ActivePage
  If pg.Shapes.Count>0 then ActiveWindow.Selection.Select(pg.Shapes.Item(1),visSelect)
  ActiveWindow.DeselectAll
End Sub


2)
You create your own ShapeData-Dialog with a Windows-Form in the VBA-Editor, so it contains all shapedata.

3) You create Actions (contextmenu) for the page, each one pertaining to a bunch of ShapeDatas. Each action switches some of the ShapeData to vivible, others to invisible and than opens the ShapeData-Dialog, that now only shows a (planed) selection of ShapeData. I think vojo or wapperdude has posted some examples for that here.

hth Jumpy

AndyW

How about catching the cell changed event and if its your Prop.HVAC, then close and show the shape data window again.

Private WithEvents vsoApp As Visio.Application

Private Sub Document_DocumentCreated(ByVal Doc As IVDocument)

    Set vsoApp = Application

End Sub

Private Sub Document_DocumentOpened(ByVal Doc As IVDocument)

    Set vsoApp = Application
   
End Sub

Private Sub vsoApp_CellChanged(ByVal Cell As IVCell)

    If Cell.Name = "Prop.HVAC" Then
   
        Application.ActiveWindow.Windows.ItemFromID(visWinIDCustProp).Close

        Application.ActiveWindow.Windows.ItemFromID(visWinIDCustProp).Visible = True

    End If
   
End Sub
Live life with an open mind