Jump to content

Can I change color of text in a field..


The Dog

This topic is 6542 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi All.

First of all I want to say thanks for the help I have recived from this site...

Next I have yet another problem ;o)

I want to make the color of the text in a field depend on the content of the field.

Something like this:

if xx=0 set color to red else set color to black

Looked at the different script functions but have not found any that I think/know could do the job....

Any help would be great

Best regards

The Dog

Link to comment
Share on other sites

You can create your field to be an auto-calc with replace (keep it as a text field, and double-click on the field definition and check auto-calculation, make sure "with replace":

Case(

field1 = 0; TextColor(field1; RGB(255;0;0));

field1 = 1; TextColor(field1; RGB(0;255;0));

TextColor(field1; RGB(0;0;0))

I hope that helps!

Link to comment
Share on other sites

Nice ... but The Dog is vs. 6, Martha. I see no indication that they want this for vs. 7/8. :crazy2:

UPDATE: You can use a regular calculation and stack it on top of your standard field. Regular calculation would be formatted in your color (from field format level). Then calculation would be something like:

Case ( xx=0 ; theField )

In this way, it would show if the condition were true and no show if it wasn't true. Set the calc to not allow entry into field and make the border and fill transparent. Use Arrange to stack them precisely and make sure calc is on top (use Arrange > Bring to Front). When properly stacked, the calc will display on top of (appearing in place of) the standard field.

Link to comment
Share on other sites

No worry ... I've done it also. :wink2:

BTW, it's been awhile since I've used vs. 6 and the above isn't tested. But I'm pretty confident that's what I used to use.

Link to comment
Share on other sites

This topic is 6542 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.