Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Thursday, June 19, 2025 
 
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 - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Format Individual Grid Cell
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Format Individual Grid CellYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Jul 07 7:31 AM
Is it possible to format individual grid cells? I have a column in that I want to change the font color of each individual cell based on whether the value is negative or positive. I am able to change entire rows or columns, but have not had any luck with individual cells..

I have tried something like this OnCustomDrawCell of the grid experimenting with BOLD:

If dgSecurities.getcurrentfield("Discountpremium")<0 then

dgSecurities.SetFieldValue dgSecurities.getcurrentfield("C_Opp_Securitiesid"), "GFCOMMIT", Font.bold

else
'Font.Bold=False
End If

Is it possible to set the color of each node in a column seperately? Thanks
[Reply][Quote]
Raz
Posts: 5
 
Re: Format Individual Grid CellYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Jul 07 3:22 AM
I got this code from another post. It works well for individual cells. You need to use the CustomDrawCell event of the datagrid to do this.

Hope that helps.

Also, could you send me the bit of code to change an entire row based on a value in the datagrid.

Thanks.

================
Colouring a grid
================

For the Grid - select the property "OnCustomDrawCell" - this will create a sub based on the name of the grid followed by CustomDrawCell e.g.
--------------|-------------|
Sub dgServicesCustomDrawCell(Sender, ByRef Node, ByRef Column, IsSelected, IsFocused, ByRef Text, ByRef Color, ByRef Alignment, ByRef Font, ByRef FontColor)

Dim sFieldName
Dim vStatus
Dim lColumnIndex

sFieldName = UCase ( Column.FieldName ) ' Field you want to look for

Select Case sFieldName
Case "A2_STATUS" ' ALIAS name of the column in QB
lColumnIndex = GetColumnIndexByFieldName ( dgServices,"A2_STATUS" ) ' Used so that grid can be sorted/grouped
vStatus = Node.Values ( lColumnIndex ) ' Gets the actual value
End Select

If Not IsNull ( vStatus ) Then ' Ensure you check for Nulls

Select Case vStatus
Case "Open"
FontColor = &H00000000 ' in v7.x - you can use enum of clBlack, clGreen etc
Case "Lost"
FontColor = &H000000FF
Case "Won"
FontColor = &H00800000
Font.Bold = True
End Select
End If

End Sub

'==========================================================================================
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
[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 © 2025 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): 6/19/2025 4:41:48 AM