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 - 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: Datagrid Color based on Contact Status
Paula Shuler
Posts: 22
 
Datagrid Color based on Contact StatusYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Oct 15 1:33 PM

Hello everyone,


I am trying to edit a data grid I have for contacts in which we display certain items (name, phone number, status, etc). I want to show if their status is deceased, for that word to be red. So far after scouring the forms I did this:


 


Sub grdContactsCustomDrawCell(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 ( "STATUS" ) ' Field you want to look for


 


Select Case sFieldName


Case "A1.STATUS" ' ALIAS name of the column in QB


lColumnIndex = GetColumnIndexByFieldName ( grdContacts,"A1.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 "Active"


FontColor = clBlack ' in v7.x - you can use enum of clBlack, clGreen etc


Case "Inactive"


FontColor = clRed


Case "Deceased"


FontColor = clRed


Font.Bold = True


End Select


End If


End Sub


 


This is not working however, and I am not sure where I am messing up. Any feedback would be great.


 

[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Datagrid Color based on Contact StatusYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Oct 15 2:21 PM
I recognise that - I think you are missing a function (GetColumn...) which was in original example. Email if you need it.
[Reply][Quote]
Paula Shuler
Posts: 22
 
Re: Datagrid Color based on Contact StatusYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Oct 15 3:20 PM

This is what I have:


 


 


Sub grdContactsCustomDrawCell(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 "A1.STATUS" ' ALIAS name of the column in QB

lColumnIndex = GetColumnIndexByFieldName ( grdContacts,"A1.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 "Active"

FontColor = &H00000000 ' in v7.x - you can use enum of clBlack, clGreen etc


Case "Inactive"

FontColor = &H000000FF

 

Case "Deceased"

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]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Datagrid Color based on Contact StatusYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Oct 15 3:31 PM
Is your column called Status ? If not, you need to adjust it to suit. also, active, inactive to deceased, alive, dead etc.
Also, you can't colour a read only grid (where rowselect = True). Rather, it has to be the in-cell editor version and set the cells to read-only if needs be.

Email me as mike.spragg@empath-e.com complete code as not easy to dialogue here.
[Reply][Quote]
Paula Shuler
Posts: 22
 
Re: Datagrid Color based on Contact StatusYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Oct 15 5:46 PM

For those curious, this has been solved. Thanks to Mike and his uber experience, I was able to get this working.


 


Basically I had not linked the event to the sub that was typed up.

[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:08:35 AM