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

Display alternate rows with different colors

578 views
Skip to first unread message

Vidhi

unread,
May 5, 2003, 6:18:09 PM5/5/03
to
I need to display every alternat row in one color and the next is a
different color
as black
white
black
white

How can I do this, is there a way to identify if the row is an even number
or a odd number?
Thanks

Glenn Barber

unread,
May 5, 2003, 10:16:44 PM5/5/03
to
Try the datawindow function Mod (dividing by two) in the background color
testing for the remainder result
of dividing the Rowno by 2.


<Vidhi> wrote in message news:#Hx6VS1EDHA.62@forums-1-dub...

fc...@dd.com

unread,
May 6, 2003, 2:16:21 AM5/6/03
to

In The ancestor of the datawindow control I made a function which is called
in the constructor to use alternate colors depending on the color settings
in the INI file.

johan.v...@solutia.com

Long ll_LineColorEven,ll_LineColorOneven
String ls_Modify="",ls_Result
//n_cst_color lnv_color

is_LineColorEven=ProfileString(gnv_app.of_GetAppIniFile(),'LineColor','Even'
,"<DEF>")
if(is_LineColorEven="")then is_LineColorEven="<BG>"

is_LineColorOnEven=ProfileString(gnv_app.of_GetAppIniFile(),'LineColor','Odd
',"<DEF>")
if(is_LineColorOnEven="")then is_LineColorOnEven="<BG>"

choose case is_LineColorEven
case "<DEF>"
ll_LineColorEven = long(Describe("DataWindow.detail.Color"))
case "<BG>"
ll_LineColorEven = long(Describe("DataWindow.detail.Color"))
case else
ll_LineColorEven = long(is_LineColorEven)
end choose

choose case is_LineColorOnEven
case "<DEF>"
ll_LineColorOnEven = rgb(210,210,210)
case "<BG>"
ll_LineColorOnEven = long(Describe("DataWindow.detail.Color"))
case else
ll_LineColorOnEven = long(is_LineColorOnEven)
end choose

//ll_LineColorEven = long(Describe("DataWindow.detail.Color"))
//gnvo_appl.invo_ColorStyles.il_WindowBackground
//ll_LineColorOnEven = rgb(210,210,210) //lnv_color.CYAN
//gnvo_appl.invo_ColorStyles.il_ButtonFace //LIGHT_GRAY

if ab_enabled then
ls_modify = "DataWindow.Detail.Color=
'0~tif(mod(GetRow(),2 )=0,"+String(ll_LineColorEven)+","+String(ll_LineColor
Oneven)+")'"
else
ls_modify = "DataWindow.Detail.Color=
'0~tif(mod(GetRow(),2 )=0,"+String(ll_LineColorEven)+","+String(ll_LineColor
Even)+")'"
end if

ls_result = Modify(ls_modify)

return 1

<Vidhi> wrote in message news:#Hx6VS1EDHA.62@forums-1-dub...

bede

unread,
May 6, 2003, 3:22:57 AM5/6/03
to
You could create a global function that returns the colour-value for a
passed rownumber..
f_getrowcolour(long: al_row) returns long

Then set an expression (using Modify() or using the dw-painter) for the
background.color property on all dw-controls: background.color=
'f_getrowcolour(getrow()) '

Ben

<Vidhi> wrote in message news:#Hx6VS1EDHA.62@forums-1-dub...

Paul Horan[TeamSybase]

unread,
May 6, 2003, 9:23:08 AM5/6/03
to
I really advise against using global functions in datawindow expressions.
They get re-evaluated with each "repaint" of the screen, and can seriously
affect performance.

--
Paul Horan[TeamSybase]
VCI Springfield, MA
www.vcisolutions.com

Join the PB9 Book mailing list!
www.pb9book.com

"bede" <be...@sofico.be> wrote in message
news:uaOs#D6EDHA.222@forums-2-dub...

Glenn Barber

unread,
May 6, 2003, 4:28:43 PM5/6/03
to
I Agree, and they drive you crazy when debugging....

"Paul Horan[TeamSybase]" <paulhATvcisolutionsDOTcom> wrote in message
news:u$H60N9EDHA.284@forums-2-dub...

Chris Werner

unread,
May 7, 2003, 10:01:32 AM5/7/03
to
are you sure with the 1 in MOD(getrow(),1)?


--
Chris Werner

<dw-extreme> schrieb im Newsbeitrag
news:FBBD9C4F97343451004EDEAA85256D1F.005EFC3F85256D1E@webforums...
> Put a large empty text field or rectangle in your detail area. In the
> background color expression put the following expression:
>
> IF(MOD(getrow(),1)= 1,16777215,0)
>
> to alternate between black and white. Modify the colors '16777215,0' to
> the colors you want.


dw-extreme

unread,
May 7, 2003, 10:21:28 AM5/7/03
to

Vidhi

unread,
May 7, 2003, 10:18:36 AM5/7/03
to
Make that 2, that should work. Thanks for the Ideas Folks and thank you
Dw-Extreme(don't know your name)
"Chris Werner" <c...@f-s.de> wrote in message
news:%23AC4%23HKFDHA.287@forums-2-dub...

Tyler Craft

unread,
May 7, 2003, 1:18:29 PM5/7/03
to
I forgot to mention you could load these values on the open of the
application so that you would get the different color styles between
Operating systems and themes.

Tyler

"Tyler Craft" <tyler...@gnb.caNo_Spam_Please> wrote in message
news:Okty6xLFDHA.331@forums-1-dub...
> If you are doing new development this may be an alternative.
>
> In the application open load a table called system_colors.
> ID COLOR_NAME COLOR_VALUE
>
> in the sql for the datawindows add the extra columns as column selects.
>
> So you would have
>
> Select <normal_part>,
> (select COLOR_VALUE from system_colors where COLOR_NAME = 'ButtonFace') as
> c_buttonface,
> (select COLOR_VALUE from system_colors where COLOR_NAME =
> 'SystemBackground') as c_sysBackground
>
>
> Just an idea, (WARNING I HAVE NOT TESTED THIS)
> Tyler
>
> "Connie Susut" <csu...@radss.com> wrote in message
> news:OPQvmsLFDHA.62@forums-1-dub...
> > It absolutely drive me crazy when debugging, but we are using ButtonFace
> and
> > WindowsBackground colors in our app, and I haven't had time to look at
> > changing away from the old global functions. Anyone with suggestions on
> how
> > I can still use the Windows colors without global functions?
> >
> > "Glenn Barber" <GABa...@msn.com> wrote in message
> > news:uvl#E8AFDHA.62@forums-1-dub...

Connie Susut

unread,
May 7, 2003, 1:23:29 PM5/7/03
to
Interesting idea. The only problem for us is that we are using the
workstation's color settings, so we can't use something that is hard coded
into the database.

"Tyler Craft" <tyler...@gnb.caNo_Spam_Please> wrote in message
news:Okty6xLFDHA.331@forums-1-dub...
> If you are doing new development this may be an alternative.
>
> In the application open load a table called system_colors.
> ID COLOR_NAME COLOR_VALUE
>
> in the sql for the datawindows add the extra columns as column selects.
>
> So you would have
>
> Select <normal_part>,
> (select COLOR_VALUE from system_colors where COLOR_NAME = 'ButtonFace') as
> c_buttonface,
> (select COLOR_VALUE from system_colors where COLOR_NAME =
> 'SystemBackground') as c_sysBackground
>
>
> Just an idea, (WARNING I HAVE NOT TESTED THIS)
> Tyler
>
> "Connie Susut" <csu...@radss.com> wrote in message
> news:OPQvmsLFDHA.62@forums-1-dub...
> > It absolutely drive me crazy when debugging, but we are using ButtonFace
> and
> > WindowsBackground colors in our app, and I haven't had time to look at
> > changing away from the old global functions. Anyone with suggestions on
> how
> > I can still use the Windows colors without global functions?
> >
> > "Glenn Barber" <GABa...@msn.com> wrote in message
> > news:uvl#E8AFDHA.62@forums-1-dub...

Connie Susut

unread,
May 7, 2003, 1:04:17 PM5/7/03
to
It absolutely drive me crazy when debugging, but we are using ButtonFace and
WindowsBackground colors in our app, and I haven't had time to look at
changing away from the old global functions. Anyone with suggestions on how
I can still use the Windows colors without global functions?

"Glenn Barber" <GABa...@msn.com> wrote in message
news:uvl#E8AFDHA.62@forums-1-dub...

Tyler Craft

unread,
May 7, 2003, 1:13:51 PM5/7/03
to
If you are doing new development this may be an alternative.

In the application open load a table called system_colors.
ID COLOR_NAME COLOR_VALUE

in the sql for the datawindows add the extra columns as column selects.

So you would have

Select <normal_part>,
(select COLOR_VALUE from system_colors where COLOR_NAME = 'ButtonFace') as
c_buttonface,
(select COLOR_VALUE from system_colors where COLOR_NAME =
'SystemBackground') as c_sysBackground


Just an idea, (WARNING I HAVE NOT TESTED THIS)
Tyler

"Connie Susut" <csu...@radss.com> wrote in message
news:OPQvmsLFDHA.62@forums-1-dub...

Tyler Craft

unread,
May 7, 2003, 1:53:14 PM5/7/03
to
I often get the value from an object that I know has the color I am looking
for. IE ls_backColor = lwin.backgroundcolor, If you did this and assigned
the value to the database, maybe add the usersid into the where for the
embedded select. It might work.

Tyler

"Connie Susut" <csu...@radss.com> wrote in message

news:ekNQV3LFDHA.62@forums-1-dub...

0 new messages