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!

Changing Row Color in RetrieveRow Event of DW?

Status
Not open for further replies.

kaul125

Programmer
Jan 29, 2002
87
US
As I'm retrieving rows, or even at the end of the retrieve, I want to change the row color based on the value of a certain field. I put the following code in the RetrieveRow event of my datawindow:

string mod_string

mod_string = "DataWindow.Detail.Color = 'String(rgb(255,255,255))~tif(field_name>0,rgb(255,255,0),rgb(255,255,255))'"

dw.Modify(mod_string)

return 0

The above code does not work. The rows are not changing color. If the field is > 0, then I want the row to be yellow else white.

What is wrong with the above code and is this the proper event to put it in?

Also, I want another condition as part of the if statement:

If field>0 and Not isnull(field) then.....

I also tried the above code with this additional condition and it did not work.

Thanks,

Keith
 
I find it easier to accomplish this in the datawindow painter itself buy putting an expression in the background color property of each column.

for example:

if (recordtype[0] = 'T',RGB(255,128,192),if (recordtype[0] = 'A',RGB(0,128,255),if (recordtype[0] = 'K',RGB(0,128,255),RGB(192,192,192))))
 
Hello ,
Try this
code:
This.Modify("#" + String(ll_index) + ".Background.Color='0~t if(del = 1, 255 , 80269524)'")

where ll_index is the loop that you will create for each column.The if statement is something you will need to accept.Meaning with this you must have a condition to do that.The "255" , "80269524" is the color you want to have in the columns.You can change it.Good Luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top