Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, November 30, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - Controls
Forum to discuss usage & tips for SalesLogix controls and other 3rd party ActiveX controls. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to Controls | New ThreadView:  Search:  
 Author  Thread: Changing Row Color in Datagrid
Gus
Posts: 18
 
Changing Row Color in DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 12 Mar 07 2:47 PM
fiogf49gjkf0d
Hi,

Is it possible to change the color of selected rows (depending on specific column values in linked table) ?

e.g., I want to change the color of the rows whose column myType is 3 ?

Thanks
[Reply][Quote]
Jason Huber
Posts: 77
 
Re: Changing Row Color in DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Mar 07 12:47 AM
fiogf49gjkf0d
Sure. Here is the stuff you need:

onCustomdrawCell contains a ref to each cell as it is drawn. You can then grab the value of the cell and check it then change its color.

A few other helpful items are:
Node
.Index
.IsSelected
.Text
.Color

I forget who was in Dianes Dev 7 class this week since I am out watching my newborn, but Diane wrote the book and it is on page. 81 if you can send them an email and ask them to look at the code in the back of the book for an exact reprint.
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Changing Row Color in DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Mar 07 1:27 PM
fiogf49gjkf0d
As Jason mentioned, the event you need is the CustomDrawCell event. It will give you access to change properties of the cell at runtime as it is created.

However, one thing to keep in mind, it will fire with the creation of each cell. So, in your case, you *won't* want to perform your checking with each fireing of the CustomerDrawCell event, since you'll be repeating your logic with the painting of each cell, duplicating the checking for each row by the number of cells in a row. KNow what I mean?

What you might want to do is only perform your checking if the cell is the primary key cell (as an example), and then check the values for the Node (row). The Node object passed into the CustomDrawCell event is the most useful of all of the stuff you are provided with there. It gives you an array of all of the values on the current row.

So you might do something like this (I don't have access to SLX at the moment so guessing at syntax):


If (Index = 0) Then ' we're only checking for the primary key cell event
' assuming the field you want to check is at index 2 in the columns for the row
If Node(2) = "3" Then
Color = RGB(255, 0, 0)
End If
End If


Anyway something like that.
[Reply][Quote]
Michael Rogers
Posts: 70
 
Re: Changing Row Color in DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Apr 08 7:08 PM
Ryan,

We were having an issue when a user moused over a record that had had the color changed (just one .value, not all colors) the grid would repaint. A real issue when looking at record 568 of 1000.

I modified our code to check only on column as you suggested, but only that cell gets it's color changed. On the plus side, the users can now highlight record 568 to right-click and edit.

Any ideas how to color the whole row without the grid reloading every time I mouse over a colored cell?

Michael
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Changing Row Color in DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Apr 08 11:45 AM
WITH NODE
IF .ISSELECTED THEN
color = clMoneyGreen


END IF
END WITH

This is EXTREMELY processor intensive.....any move of the mouse over the grid (i.e. one pixel move) repaints the entire grid.......
Did I mention ANY?

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/30/2024 1:27:55 AM