Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Color Format in Paradox 1

Status
Not open for further replies.

LWB

Technical User
Feb 4, 2003
95
US
I'm trying to create a form that will color code related data. I figured I could just increment the number that matches the color by a fixed amount. However the number representation of the color doesn't match any of the Paradox RGB, CMY or HSV "custom color" formats. Does anyone know what the format actually is?

Also for a table frame that can be scrolled, where do I attach the color to change the self.color as the user scrolls down?

Lynn
 
Lbw,

I would normally attach the self.color to the "newValue" event so the color changes whenever the value of the field changes. I can't help you with the color numbering maybe someone else can.

Perrin
 
Lynn,

The color format is a longInt created from the separate Red, Green, and Blue elements of the color you're trying to create.

The basic code is:

Code:
method pushButton(var eventInfo Event)
var
   liColor  LongInt
endVar

   liColor = rgb( fldR.Value, fldG.Value, fldB.Value )
   fldColor.Value = liColor
   boxDemo.color = liColor

endMethod

This is taken from a form with four field objects, a box, and a button.

As far as changing colors in table frames, there are some design considerations that should be taken into account, not the least of which is that the table frame is a display object, not necessary a data containers. That is, there aren't hidden record objects for rows that aren't being displayed. Instead, each Record object refers to an on-screen area. It's a sublte, but important distinction.

Take a peek at which shows how to highlight records objects to show the selected record and then notice the amount of work needed to associate the on-screen row with the underlying record.

A better approach for your needs might be to embed a hidden calculated field object with the desired color and then to use that to control the color of your field object. I don't have an example, but I have used this in the past. It works because Paradox knows how to update calculated fields and you leverage that knowledge to get the desired effect.

Hope this helps...

-- Lance
 
Perrin & Lance,

That was exactly what I wanted to know! I'm not actually using a table frame on my real form (that was just for testing colors), but it seems to me that there as got to be an easier approach to what I really want to do.

I have a form with a bunch of fields (alphanumeric) displayed on it (all part of a single record). The fields are inside boxes. I would like the code on the form to scan the displayed fields for duplicates and change the color of the boxes that contain these fields to the same color. There could be anywhere from 0 and up duplicates on the form (and there may be many sets of duplicates). In other words I could end up with 2 blue boxes, 6 green boxes, 3 yellow boxes on the form, and 5 pink boxes.

I know I can scan the table and find the duplicates and associate a color with each of them - but is there a way to do this on the form itself - I have no reason to save the information, I just want to display it.

Lynn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top