Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, November 26, 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: Coloring Rows in the Datagrid Control
Mike Boysen
Posts: 53
 
Coloring Rows in the Datagrid ControlYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Mar 06 9:49 AM
Using the grids CustomDrawCell event. you can specific an entire row to be colored based on a column value. You can also specify only a single cell to be colored (which is really whats happening here).

Thanks to Eugenio's column index function we can access a value from a node. If you want to do altnerating rows (ie, greenbar), there is a commented out section that shows you how. This example is based on a history grid. Thanks to E for pioneering on this one.

Function GetColumnIndexByFieldName ( ByRef Grid, ByVal FieldName )
Dim i
Dim lColumnIndex

lColumnIndex = -1
For i = 0 To Grid.Columns.Count - 1
If UCase ( Grid.Columns(i).FieldName ) = UCase ( FieldName ) Then
lColumnIndex = i
Exit For
End If
Next
GetColumnIndexByFieldName = lColumnIndex
End Function


Sub dgColorCustomDrawCell(Sender, ByRef Node, ByRef Column, IsSelected, IsFocused, ByRef Text, ByRef Color, ByRef Alignment, ByRef Font, ByRef FontColor)
Dim sFieldName
Dim vType
Dim lColumnIndex

On Error Resume Next

'alternating colored rows
'If Int(Node.Index Mod 2) = 0 Then
'Color = Application.BasicFunctions.StringToColor("Silver")
'End if

sFieldName = UCase (Column.FieldName) 'use this if you want to limit which cells are colored

'this will color a row based on the value in the field "A2_TEXT"
lColumnIndex = GetColumnIndexByFieldName (dgColor,"A2_TEXT")
vType = Node.Values (lColumnIndex)

If vType <> "" Then
If vType = "Note" Then
Color = Application.BasicFunctions.StringToColor ("Red")
End If
If vType = "Meeting" Then
Color = Application.BasicFunctions.StringToColor ("Yellow")
End if
If vType = "To-Do" Then
Color = Application.BasicFunctions.StringToColor ("Silver")
End if
If vType = "Phone Call" Then
Color = Application.BasicFunctions.StringToColor ("Aqua")
End if
End If
End Sub
[Reply][Quote]
Mike Boysen
Posts: 53
 
Re: Coloring Rows in the Datagrid ControlYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Mar 06 9:50 AM
fiogf49gjkf0d
I wish I could add a picture. It's really cool!
[Reply][Quote]
Mike Boysen
Posts: 53
 
Re: Coloring Rows in the Datagrid ControlYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Mar 06 9:57 AM
I should mention that this is for 6.2.3 only.
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Coloring Rows in the Datagrid ControlYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Mar 06 12:20 PM
fiogf49gjkf0d
Yeah, this is a great trick. Just awesome. I mentioned to Eugenio that it would be great on this site and he's promised me a full article detailing the steps.

Thanks for the post Mike. BTW, you can post images, but you just have to have to place them on your own server and then add an img tag to them. The posts do allow some markup, but obviously not script tags and other annoying ort harmful tags.

-Ryan
[Reply][Quote]
Mike Boysen
Posts: 53
 
Re: Coloring Rows in the Datagrid ControlYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Mar 06 2:21 PM

cheap abortion clinics in georgia

cheap abortion clinics las vegas click here
fiogf49gjkf0d
I figured I could use an img tab. I was just trying to get Top 10 Poster status
[Reply][Quote]
John Crumpton
Posts: 26
 
Re: Coloring Rows in the Datagrid ControlYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Mar 06 9:21 AM

symbicort vs advair price

symbicort vs advair vs breo open
fiogf49gjkf0d
It's great to hear that we can do this in 6.2.3
I tried to get it to work in 6.2.2 with no success...even using the controls from DevExpress.
I had to use an external .net app

You can display different editors in the same column based on the value of a field as well using the CustomNodeCellEdit event

Private Sub treeList2_GetCustomNodeCellEdit(ByVal sender As Object, ByVal e As DevExpress.XtraTreeList.GetCustomNodeCellEditEventArgs) Handles TreeList2.CustomNodeCellEdit

If e.Node.Item(TreeList2.Columns.ColumnByName("serialized")) = 0 Then
e.RepositoryItem = RepositoryItemButtonEdit1
Else
e.RepositoryItem = RepositoryItemComboBox2
End If

End Sub
[Reply][Quote]
Mike Boysen
Posts: 53
 
Re: Coloring Rows in the Datagrid ControlYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Mar 06 9:25 AM

can i buy abortion pill online

can i buy the abortion pill over the counter
fiogf49gjkf0d
You're speaking of the Quantim Grid, right? I was talking about the SLX grid that is based on the Quantum grid
[Reply][Quote]
John Crumpton
Posts: 26
 
Re: Coloring Rows in the Datagrid ControlYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Mar 06 9:34 AM

over the counter albuterol inhaler walmart

albuterol otc usa blog.propartsdirect.net
fiogf49gjkf0d
Yes, I was referring to the Quantum grid from DevExpress. (and Quantum treelist and the .net equivalents)
When I use the Quantum grid in SL 6.2.2, it lists the custom draw events in Architect, but SL never raises the events.
[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/26/2024 3:12:16 AM