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

Dynamic Datawindow Background Color

1,117 views
Skip to first unread message

meb.t...@gmail.com

unread,
Aug 18, 2008, 1:44:18 PM8/18/08
to
How can I modify a datawindow object to change a column record's
background.color value using an "if" statement?

In the datawindow painter I can add the following "if" statement to
the background.color.

if ( isNull(#1), 12648384, 16777215)

This will make the background color white for column 1 if the value is
not null and light green if the value is null. If I look at the
Datawindow Syntax for column 1 I see the following.

background.color="16777215~tif ( isNull(#1), 12648384, 16777215)"

How can an "if" statement like the above be created using the
datawindow Modify function rather than the datawindow painter? I have
tried the following but none of them work.

dw_details.Modify("#1.Background.Color='16777215~tif ( isNull(#1),
12648384, 16777215)'")
dw_details.Modify("#1.Background.Color='16777215~~tif ( isNull(#1),
12648384, 16777215)'")
dw_details.Modify("#1.Background.Color='16777215~~~tif ( isNull(#1),
12648384, 16777215)'")
dw_details.Modify("#1.Background.Color='16777215~~~~tif ( isNull(#1),
12648384, 16777215)'")

Any help would be greatly appreciated. Thank you!

Jason 'Bug' Fenter [TeamSybase]

unread,
Aug 18, 2008, 2:54:28 PM8/18/08
to
I seem to be having all kinds of quirkiness with it. Apparently, you
can't set background properties for invisible controls (columns that you
"delete" off of the datawindow"). I also can't seem to modify a
background property using a column number.

Try this:
String ls_name, ls_valid
Long i

FOR i = Long (dw_1.Describe ("datawindow.column.count")) TO 1 STEP -1
ls_name = dw_1.Describe ("#" + String (i) + ".Name")
ls_valid = dw_1.Describe (ls_name + ".background.mode")
IF ls_Valid <> '!' THEN
dw_1.Modify (ls_name + ".Background.Mode='0'")
dw_1.Modify (ls_name + ".Background.Color='16777215~tif(isnull(" +
ls_name + "), 12648384, 16777215)'")
END IF
NEXT

meb.t...@gmail.com

unread,
Aug 18, 2008, 3:28:38 PM8/18/08
to
On Aug 18, 11:54 am, "Jason 'Bug' Fenter [TeamSybase]"
> > Any help would be greatly appreciated.  Thank you!- Hide quoted text -
>
> - Show quoted text -

I added your recommendation to my code and then added the statement
below.

ls_attributes = dw_1.Describe("DataWindow.syntax")

The "~t" in your statement "dw_1.Modify (ls_name +
".Background.Color='16777215~tif(isnull(" +
ls_name + "), 12648384, 16777215)'")" appears as below in
ls_attributes for each of my columns. (The "~t" is interpreted as a
tab.)

background.color="16777215 if(isnull(eiacodxa), 12648384, 16777215)"

How can I keep the Modify function from interpreting "~t" as a tab?

meb.t...@gmail.com

unread,
Aug 18, 2008, 4:23:42 PM8/18/08
to
> How can I keep the Modify function from interpreting "~t" as a tab?- Hide quoted text -

>
> - Show quoted text -

I mentioned in my last post that the "~t" is converted to a tab when I
view the results of the Describe("DataWindow.syntax"). Previously, I
was not seeing the desired column color changes at runtime when the
"~t" showed up as a tab via the Describe("DataWindow.syntax"),
however, this time around the background is changing colors at runtime
as desired so all is well. Thank you for your help.

Dean Jones

unread,
Aug 18, 2008, 4:22:08 PM8/18/08
to
It needs to be a tab.

--
Dean Jones
CEO
PowerObjects
http://www.powerobjects.com
(612) 339-3355 Ext. 112

TeamSybase
* * Think Sybase * *


<meb.t...@gmail.com> wrote in message
news:380aae25-9cec-47e1...@n33g2000pri.googlegroups.com...

Dean Jones

unread,
Aug 18, 2008, 4:24:10 PM8/18/08
to
Defaultvalue is a value that can be converted to the appropriate datatype
for the property. It is followed by a tab (~t).

TeamSybase
* * Think Sybase * *


<meb.t...@gmail.com> wrote in message
news:380aae25-9cec-47e1...@n33g2000pri.googlegroups.com...

0 new messages