Change fill based on user entered shape data

Started by Michelle, June 18, 2008, 02:19:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Michelle

I'd like to add another shape to my original shape that changes which fill is shown depending on which option the user selects when they place the shape in a drawing.  I drew a shape in my master, and in it's shape sheet, I am trying this:  IF(STRSAME(Sheet.5!Prop.PanelDirection="B","B Vault Panels","A Vault Panels"))  where Sheet 5 is the original shape in the master and "B Vault Panels" and "A Vault Panels" are fills that I created. 

If the above is not possible, I could create two similar shapes, one with each fill and just have them Show or not show depending on the user's choices.  I tried this by entering: =NOT(STRSAME(Class 2 Vault!Prop.PanelDirection="A",TRUE)) in the Geometry1.NoShow cell of the added shape, but it also does not work. 

I hope my question is not too basic, I have become the go to Visio person in my office, and feel over my head at times... :-[
TIA,
Michelle

Visio Guy

Hi Michelle,

You're close, but you need to get SHAPETEXT(Sheet.5!TheText) to get the string of the text from the group, and you need to use a string-comparison function to test it. You can't do a direct "A"="B" in the ShapeSheet (both strings evaluate to zero, sort of).

Try this instead:

FillPattern =IF( STRSAME( SHAPETEXT(Sheet.5!TheText),"Vault Panels A"), USE("A"), USE("B") )

You might add GUARD( ) around the whole thing as well to prevent users from overwriting your fill pattern.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Michelle

Hmm, That didn't work, either.  I must have something in the original shape wrong.  The idea is that the user will place the shape then make several choices in a shape data box that will help form the correct part number as well as direct the form and look of the shape.  I do have the part number portion of this equation working. When the user chooses either "A" or "B" from the pull down, the corresponding letter appears in the part number.  I'd like to add the fill to visually show the user thay have made the correct choice.  I am wondering now if I am doing something wrong in my adding a shape while working in the master shape...  Do I need to group the new shape with the original master shape? 

In trying to "understand" the text string you suggested, I tracked down the cell "TheText" to see if I could get the logic behind the string... but my TheText cell in Sheet.5 has no formula. 

Thanks again for your patience!
Michelle

Visio Guy

TheText is really kind of a token--a placeholder--so to speak. I don't know if it's really related to TheText cell that you're referring to in the Events section, I suppose so. But TheText itself has no meaning without using the string comparison functions.

I tried the formula I gave you in a shape I built, so it should work.

Try breaking it all up into pieces to see if your text comparisons are working. You can show values or formulas in the ShapeSheet, so you can look for TRUE or FALSE values. Once you know that your text comparisons are working, then you can worry about fill patterns.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Michelle

First I feel I must apologize for my lack of experience!  :-[

I have been working on trying to figure this issue out.  I have been trying to use the formula you gave me, but I can't get it to work.  It does seem like my problem stems from the fact that the choice the user has to make is "A or B", and not "1 or 2".  I can't change that aspect though, as the part number created has to be an A or a B. 

When I couldn't get the fill change to work I tried to focus on just making blocks with the desired fills either show or not show depending on the user's choice.  I could only get it to work one time in desperation when I changed the user's choice to "1 or 2".  Then I changed the Geometry.NoShow Cell to read:"STRSAME(Sheet.5!Prop.PanelDirection="1",True,False)    This does not work if I change back to "A or B".  Argggh!  I also tried to modify the suggestion you gave me to work in the Geometry.NoShow Cell, using: IF( STRSAME( SHAPETEXT(Sheet.5!TheText),"A"), False, True )  with no success.  The closest I can get is a long line of formula text and the outcome is the shape is either always on or always hidden. 

Thanks again!
Michelle

P.S. Is there any way to attach a shape to a post so you can see it? 

Lars-Erik

You can attach a document with the shape in it to a post.
While posting click on "Additional Options..." right below the text window you type.
The rest should be clear enough.

- Lars

Michelle

Thanks Lars. 

I have attached a file with my shape as it stands now.  This thing is far from finished.  The problem I'm having is with the square to the left with the lines in it.  I created that fill to indicate panels of a certain size. (The block will be moved to overlay the other shape at some point.) Depending on what the user chooses, I'd like to have the panels show either horizontal or vertical.  If I can do that by changing the fill from one to the other, great.  If I have to have two blocks on top of each other with the different fills and set it so one or the other shows, that's fine too.  I just need to show the visual of what the panels will look like because some of our end users have trouble with the terms "parallel" and "perpendicular"!  :o

btw, Since this is no where near complete, the shape doesn't function correctly unless you use the drawing explorer and open the "Class 1 MVS" master.  (I'm not sure what the "Flex MVS Vault" master even is.  That was there before I even brought in my shape, I think it was created by the previous Visio Administrator...)

Thanks again!
Michelle

Visio Guy

Hi Michelle,

How do you want to change the fill? There are a number of possibilities:


  • User right-clicks the shape and chooses
  • User (or code) sets a Custom Property/Shape Data field
  • User enters a certain text string (fragile!)
  • Other?

I've attached a drawing that shows an example of how to make the shape respond to text. Hopefully this will help.

- Chris
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

vojo

if the fill library is small...say less than 5 different fill patterns possible....could use actions or smart tags to select.
This would free up the text for something more descriptive.

Visio Guy

I agree, vojo,

This seems like an option for the right-click menu (via Action rows) or through Shape Data fields.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Michelle

I like Chris's example, it's almost what I'm looking for, except I need the change to occur after the user chooses either A or B in a shape data pop up.  This is the same pop up available if the user selects the shape and right clicks.  I plan to have it pop up automatically upon shape placement, however.

Anyways, I tried to use the info in the shapesheet from Chris' shape to work in my situation, and still can't make it work.  I swear I must be close... ???

Thanks for the help.

Michelle

Visio Guy

With custom fill patterns, anything that is black in the fill pattern itself will take the color of the shape to which it is applied.

So if you need something to stay black, make it an extremely dark shade of gray.

Therefore, Michelle's shapes will need smart formulas for the FillPattern and for the color (FillForegnd or FillBkgnd)
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Michelle

Whoo Hoo!  I got it!  Or at least I got something that will work.  (I think...)

I created two shapes, each with the other fill.  In the Geometry1.NoShow cell for one, I have:
NOT(STRSAME(Sheet.5!Prop.PanelDirection,("A")))
Which causes the shape to show or not show based on the user's choice.  The other one of course is set for "B", so that when one is off, the other is on & vice versa. 

Of course now I have several other issues I am working on, LOL.  I will give them my best, but don't be surprised if you see me back here soon!  Thnx guys, for the support   ;D

Michelle

Visio Guy

Cool!

One thing I like to do is put the tricky logic at the top level, in the Group's ShapeSheet, in case I want to make changes later. So for your shape, you might do this at the group level:

User.isA = STRSAME( ShapeText(TheText), "A" )
User.isB = STRSAME( ShapeText(TheText), "B" )

Then in the sub-shapes, where the groups is Sheet.5:

A: Geometry1.NoShow = NOT( Sheet.5!User.isA )
B: Geometry1.NoShow = NOT( Sheet.5!User.isB )

Now the buried logic in the sub-shapes is straightforward and unlikely to be tweaked. You do the real work in User.isA and User.isB.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Michelle

I like this idea, anything to try and make things easier later on.  This would be in a User defined cells section, correct? 

I wonder, would this help with one of my current issues?  I did all that work in the master then when I go to try the shape out it's not working quite right.  The shape drops with the sub shapes all able to be clicked on.  I am trying to add GUARD to all the variables, but it's not seeming to help.  I only want the user to be able to click on the Main master shape to adjust the variables in the shape data pop up...    As I said I am still working several things out!

Michelle