Calculating Field Fill Color

General support questions.
Posts: 1
Joined: Tue Apr 12, 2005 6:23 am
PostPosted: Tue Jul 05, 2005 8:56 am
I am trying to create a script where I can set a calculation which would determine the fill color of a field based on a value of another field. Does anyone have any info on this. I have tried to find a command in the script functions but none seem to affect the fill color of a a field (or any object - it doesn't need to be a field thats color is changed).

Any info would be appreciated.
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Tue Jul 05, 2005 10:15 am
A couple options here...

a) You can have a library of container fields containing your possible colors. This library can be in its own table, or in a single repeating field. You'd then have your calculation return one of these values (one of these records/fields) depending on which color you wanted.

b) In FM7 you can manipulate the color of text directly and, given the right characters and font size, this can be made to look like a background fill in some cases. I'd experiment with the TextColor function to see if that would work for you.

For a truly cool example of what you can do with TextColor, check out Shaun's bar graph example.
John Sindelar
SeedCode
Posts: 58
Joined: Tue Jul 26, 2005 12:08 pm
Location: London
PostPosted: Tue Aug 02, 2005 4:46 am
A good way to get alternating colours for list views is:

Create the following fields:

1. A global container field sample below is called:

GBL_colourgreen


2. A calculation field the result of which is a container. Sample below is called:

Alternate_colour

If(Mod(Status(CurrentRecordNumber),2) = 0, GBL_colourgreen,"")


Now do the following:

1. In layout mode draw a block using the Filemaker drawing tool and then fill it with the required fill colour.
2. While still in layout mode copy this new block.
3. Go to Browse mode and paste it into the GBL_colourgreen field
4. Go to layout mode and go to Graphic format and format the GBL_colourgreen field as ‘reduce or enlarge image to fit frame' and unclick ’maintain original proportions’.

The result will be the colour will alternate depending on whether the record number is odd or even.

Sit the field behind the list text and it looks great!

You can of course create any number of these as a library and use as appropriate.

Trust this helps.

Dave

Return to General Support

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron
(855) SEEDCODE
[email protected]
Follow us: