Problems with RGB Function

Started by Jumpy, November 20, 2009, 01:52:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jumpy

Hi all,

I tried using Chris "Colors with Shape Data" Shape today and I'm having some troubles:

The ShapeSheet Functions are working just fine and I got something like RGB(255,0,0) in an user defined cell and this changes if I change the color. Thats fine so far.

But when I reference this cell in a LineColor cell for example, it wont work.

I have for example:
User.Color = RGB(255,0,0)
LineColor=User.Color

The Problem: No matter what numbers are in the RGB Function, the "Value" in the LineColor Cell is always 0 and therefore the color is black.

Edit:
I played a little bit more and can add some Details:
When I fill User.Color manually with RGB() it works. LineColor shows RGB() and my line changes the color.
But when I try to change the color on the Shape-Data the RGB Formula in User.Color changes, too, but LineColor does not change, instead its Value becomes 0.


I'm using Visio 2007 German Version

vojo

I do what you are trying to do all the time.    Look at the shape sheet of the following....it will give you insight


Jumpy

#2
Hi vojo,
can't open your file. I get an error message (1oo)
(It's in german and translates to sth. like file is corrupted or incomplete).

But back to my issue. I don't have problems because I don't know what to do. I'm thinking I make everything right. But it doesen't work.
I now used Chris' original shape from:

http://www.visguy.com/2009/10/21/choose-colors-with-shape-data-fields/

And it doesn't work, too.

When I change the color in the ShapeData-Window the Shape only becomes black. Even after pressing the undo button, although the selected color in the ShapeData changes back, the Shape itself doesn't and stays black.

If other people don't have this problem, can it be a bug in the German Version?
I use Visio 2007 Professional, German Version.

wapperdude

This was quick and dirty, but, uses two User defined cells:  user.FilClr and user.LineClr.  The center square has it's line color and foreground color controlled by these formulas.  Open the shapesheet to see the syntax.

HTH
Wapperdude
Visio 2019 Pro

JuneTheSecond

#4
Hi,

In my Visio the value is not 0 but RGB(255,0,0).
Is it a special problem in German version?
Best Regards,

Junichi Yoda
http://june.minibird.jp/

vojo

opens fine for me from this forum.

some shape sheet jpgs below

vojo


wapperdude

Vojo's file opened fine for me too.
Visio 2019 Pro

Jumpy

Thanks for your input and efforts so far and I hope you stay with me on this because it gets more weird again and I think I Have two different problems now:

Whats funny: I can't open any of your files, be it .vsd .jpg or ...
From all of you, not only vojo.
That's a new one.

Always a error message like "Can't read header" or "file corrupted".
Maybe something is wrong with my PC at home.

Will try again on monday on my computer at work.

--------------
But that is beside the topic of my initial problem, which I first noticed at work and now at home, too. The problem with the RGB-Function or maybe it's with updating the values in the RGB-Function following a change in a Shape-Data field.
I used Chris' original .vsd and it shows the right colors. But when I select another color in the Shape-Data something doesn't work right.

Because you all seem to have no problems with it, it may really be the german Version. I will try it out on monday with a computer without Visio. Install the 60 day trial Version but use the American or English Version an see what happens.

To zite some strange Governor: I'll be back.

Visio Guy

Könnte eine Sache von Listentrennzeichen sein...

The ShapeSheet is supposed to use a "universal" language, which is U.S. English. That means list and thousands separators are commas and decimals are points. But when you make lists for the INDEX function, the default separator is a semi-colon.

German uses a list-separator of a semicolon, so this might be causing a problem, especially if there is some sort of bug involved.

So think about the basic set of formulas:

  User.colorNames = "AliceBlue;AntiqueWhite;Aqua;..."
  User.colorValues = "RGB(240,248,255);RGB(250,235,215);RGB(0,255,255);..."
  User.color1 = INDEX( LOOKUP( Prop.color1, User.colorNames ), User.colorValues )

Try breaking User.color1 into two parts:

  User.color1Index = LOOKUP( Prop.color1, User.colorNames )
  User.color1Value = INDEX( User.color1Index, User.colorValues )

Try viewing the values in the ShapeSheet, and see if something looks wrong. If so, then try specifying your list-separator in the functions:

  User.color1Index = LOOKUP( Prop.color1, User.colorNames, ";" )
  User.color1Value = INDEX( User.color1Index, User.colorValues, ";" )

If that doesn't work, try a new list separator:

  User.colorValues = "RGB(240,248,255)|RGB(250,235,215)|RGB(0,255,255)"   // just three colors for testing!
  User.color1Index = LOOKUP( Prop.color1, User.colorNames, "|" )
  User.color1Value = INDEX( User.color1Index, User.colorValues, "|" )

Or, since there might be a problem with list-separators, change the RGB-function separators to semicolor, AND use the bar:

  User.colorValues = "RGB(240;248;255)|RGB(250;235;215)|RGB(0;255;255)"   // just three colors for testing!
  User.color1Index = LOOKUP( Prop.color1, User.colorNames, "|" )
  User.color1Value = INDEX( User.color1Index, User.colorValues, "|" )

I haven't tried setting the culture settings on my machine to German, but hopefully these examples will help you break down and find where the problem starts.

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

Jumpy

So, a first message from my PC at work:

1) I can open all your files here, thats fine. But it also means, that my PC at home is in trouble.

2) Vojo's drawing and wapperdude's drawing are working fine.

That means, that I can put a RGB function in a User.Cell and I can reference this cell from e.g.the LineColor cell.
Changing the numbers in the in the RGB-Function manually in the ShapeSheet (wapperdude) the reference still works and the LineColor changes accordingly.
I can make this changes via the Actions-Rows (vojo) and it's still working fine.

What is not working however is using the Shape-Data for changing the color (Chris' original drawing).

I will now try Chris' suggestions and an english Visio on another computer and than report back.

Jumpy

Using the english Version, it works. Testing with other seperators didn't work.
I think it's because the Index and Lookup Formula work quite fine, the problem may be another, and I have an idea.

When I put the RGB Formula in a User.Cell manually it looks RGB(255,0,0) for example.
When I then switch the Shape-Sheet-view from Formula to Value I see: RGB(255, 0, 0).
With a Space in front of the two 0.
(Referencing this cell from LineColor works)

When I put the Formula in quotemarks like "RGB(255,0,0)" it's interpreted as a String, because looking in the Value View I see: RGB(255,0,0) without the Spaces.
The referencing won't work now.

That is the same I see as result of a Index/Lookup formula, because the List is a String, too. Therefore the Value in such a cell is RGB(1,2,3) without Spaces.

I think that's where the problem is, but I don't now why it works with your Versions of Visio.

If one of you has an idea why, or what to do, or another explanation, please let me now.
Meanwhile I'm thinking of using 3 Lists one each for the R, G, B number and then putting it all together like in Vojos shape.


Aeon

#12
i found that putting brackets around the formula (RGB(R,G,B)) helps with it being identified as a formula rather then a string