Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Changing a row's text color in a datawindow

1,955 views
Skip to first unread message

EC

unread,
Mar 18, 2002, 5:58:45 PM3/18/02
to
Let's assume that I have a datawindow(dw_client) with two columns
client_first_name (char(50)) and client_last_name. Lets say that this
window returns 30 rows.

Client First Name Client Last Name

1.)John Doe
2.)Gordon Summer
.
.
.
29.)Jo Guest
30.)John Smith

How can I change the colors of the names at run time. I have no problem
changing the color of the column text "Client First Name" but do have
problems trying to change the color of a specific row's text color. for
example, how would I change the color of the the first name Jo Geust from
probably blue to red. I know this is very basic but for some reason I don't
seem to get working properly. Thanks.
EC

dawn_brown_eyes_[teamsybase]

unread,
Mar 18, 2002, 6:35:03 PM3/18/02
to
Use conditional Modify:
mod_stmt = " cc_your_comp_column.color = ~"255 ~t if (any_col =
~~~"Value"~~~" 193, 255) ~" "
dw_your_dw.Modify()
Substitute any longs for colors instead of 255 and 193
Color of your cc will be set to 193 if value in column any_col =
"value", and to 255 if not....

Or you can use same conditional expression
directly in attributes (color) in datawindow painter.
For each column, pull up the attributes and set the following for the
background color attribute, ex:
if (emp_sex="F",RGB(0,255,0),RGB(255,0,0))

Carol Burrows

unread,
Mar 19, 2002, 8:25:26 AM3/19/02
to
We use the following expression in grid style datawindows where we want
alternating rows to have a different background color. You can modify this
expression for the text color or for a given row:

If( mod(getrow(), 2)=1,11534335,16777215 )


Hope this helps...

Carol Burrows car...@dbcsmartsoftware.com

<EC> wrote in message
news:9964C7B6E9145C8E007E3A7C85256B80.007E3A9485256B80@webforums...

Bug

unread,
Mar 19, 2002, 11:06:04 AM3/19/02
to
Stick a rectangle object on your datawindow. Size it to cover the entire
row. Then send it to the back. Also, add a computed column or text field or
*something*, invisible, on each row. In your update code, validate the age
and if not present, change the value of your *something* on that row. On
your rectangle, add an expression for the color based on the value of
*something*. (You follow? I know I sound kinda vague...)


<EC> wrote in message
news:A92439475C6E400D0057E0BC85256B81.0057E0D685256B81@webforums...
> I am sorry that I forgot to mention a very important part to my question
> yesterday. Thanks to all of you guys who responded to my question
> previously posted. I am aware of the answers that you guys gave but that
> still doesn't help me in what I am trying to do. Here I will repost the
> same question with some of the additional stuff that I had missed:
> Let's assume that I have a datawindow(dw_client of type grid) with three
> columns
> client_first_name (char(50)),client_last_name and client_age. Lets say


that
> this
> window returns 30 rows.
>
>

> Client First Name Client Last Name Client Age
>
> 1.)John Doe __________
> 2.)Gordon Summer __________
> .
> .
> .
> 29.)Jo Guest ___35______
> 30.)John Smith ___25______
>
> I DO NOT HAVE PROBLEMS CHANGING THE TEXT COLOR OF THE CLIENTS FIRST NAME
> AND LAST NAME WHEN I RETRIEVE THE DATA THE FIRST TIME - I CAN USE THE
> SYNTAX THAT YOU GUYS PROVIDED YESTERDAY. MY PROBLEM IS WHEN I TRY TO
> VALIDATE WHETHER A CLIENT'S AGE HAS BEEN ENTERED BEFORE I SAVE. FOR
> EXAMPLE, JOHN DOE AND GORDON SUMMER SHOULD CHANGE TO RED WHENEVER I TRY TO
> SAVE SINCE THEIR AGE WAS NOT ENTERED.
>
> PS. IF I USE THIS SYNTAX BELOW IT CHANGES THE COLOR OF ALL ROWS AND NOT
> ONLY THE ROWS REQUIRED.
> <DW Control Name>.Object.<Textname>.Background.Color='<a long>'
> THIS ONLY WORKS WHEN I RETRIEVE AND NOT FOR VALIDATION PURPOSES.
> if (required_ind = 'Y', RGB(255,0,0),RGB(0,0,255))
>
> THANKS.


EC

unread,
Mar 19, 2002, 10:59:51 AM3/19/02
to
0 new messages