Steve Campbell | 1 May 2012 06:09

ListBox Row Font Color based on array element value

In June of 2007 I sent a message asking if there is a way to procedurally change the background and/or font
color of a specific "Row" in a ListBox displaying 4 array columns.

The solution was quick and direct.  But it fails to work in V12.

I've tried to follow more recent posts from Chip, Arnaud, David and Jeremy but my attempts have failed.

It seems simple.  I would like a Timer Form Event to set the colors for each row based on a value in the first
element of the row.  There's no problem with the Timer, just the colors.

eg:   Row       Value    Make Row/Font Color
       Row 1   "Urgent"         = Red
       Row 2   "Urgent "        = Red
       Row 3   "Important"    = Orange
       Row 4   "Done"           = Blue
       Row 5   "Routine       = Green
       Row 6   "Done"           = Blue

I am embarrassed to think how many attempts I've tried over the past 8 hours.  I've tried a method name in the
Color properties field, RBG colors and regular colors, put things on the ListBox object Method event on
load and on clicked and on display detail.  I just can't get it together.

Thanks for any help you extend.


Steve Campbell
steve@...

(Continue reading)

Sujit Shah | 1 May 2012 06:51
Picon

Re: ListBox Row Font Color based on array element value

Have you tried the "On Outside Call" event and run the colour changing
calling method in a separate process?

On Tue, May 1, 2012 at 2:09 PM, Steve Campbell <steve@...> wrote:

> In June of 2007 I sent a message asking if there is a way to procedurally
> change the background and/or font color of a specific "Row" in a ListBox
> displaying 4 array columns.
>
> The solution was quick and direct.  But it fails to work in V12.
>
> I've tried to follow more recent posts from Chip, Arnaud, David and Jeremy
> but my attempts have failed.
>
> It seems simple.  I would like a Timer Form Event to set the colors for
> each row based on a value in the first element of the row.  There's no
> problem with the Timer, just the colors.
>
> eg:   Row       Value    Make Row/Font Color
>       Row 1   "Urgent"         = Red
>       Row 2   "Urgent "        = Red
>       Row 3   "Important"    = Orange
>       Row 4   "Done"           = Blue
>       Row 5   "Routine       = Green
>       Row 6   "Done"           = Blue
>
> I am embarrassed to think how many attempts I've tried over the past 8
> hours.  I've tried a method name in the Color properties field, RBG colors
> and regular colors, put things on the ListBox object Method event on load
> and on clicked and on display detail.  I just can't get it together.
(Continue reading)

Steve Campbell | 1 May 2012 06:54

Fwd: ListBox Row Font Color (Resolved)

As usual, 5 minutes after sending a request, I stumble across the solution.

I did not grasp that putting the Longint array name into the properties field, in essence would bind the
array element with a row color.

So, I sized my array to match the others in the listbox, and just assigned the array element with an RGB value
(eg. aRowColors{4} := 0x00FF4F00) and presto chango, the color of row 4 changed.  My code to define the
color array and assign colors to rows is located on the object method of the ListBox in the On Load event.

One of the problems I had was in using RGB values that weren't recognized so the row was turning white.  Now on
to plug in the timer and this day is "over".

THanks.

Steve Campbell
steve@...

Begin forwarded message:

> From: Steve Campbell <steve@...>
> Date: May 1, 2012 12:09:29 AM EDT
> To: 4D iNug Technical <4d_tech@...>
> Subject: ListBox Row Font Color based on array element value
> Reply-To: 4D iNug Technical <4d_tech@...>
> 
> In June of 2007 I sent a message asking if there is a way to procedurally change the background and/or font
color of a specific "Row" in a ListBox displaying 4 array columns.
> 
> The solution was quick and direct.  But it fails to work in V12.
> 
(Continue reading)


Gmane