jatin_sanghi
18th May 2005, 07:47
HI all,

I'am trying to add colors to a report field.
My requirement is that i want one colour for a particular value of a variable and a seperate colour in the same report field for a diff. value of that variable.
We are havin Baan 4c4 on NT machine.
I have looked in ttdskcs, but couldn't find for diff. colours in same field.

Plz....suggest something in this regard....

Jatin

kathuria
18th May 2005, 12:26
Hi,

Please use function RGB.
e.g. is
rgb()

--------------------------------------------------------------------------------

Syntax
long rgb( long red, long green, long blue )
Description
Use this to compose a color by specifying its red, green, and blue intensities. The intensities must be in the range 0 to 255.

Return values
A long which can be used as a color in graphical contexts such as windows, user interface controls, and so on.

Context
3GL library function.

Example
long new_color, red_int, green_int, blue_int
new_color = rgb(46,139,87)
red_int = red.component( new_color ) | 46
green_int = green.component( new_color ) | 139
blue_int = blue.component( new_color ) | 87





Sanjay

iamdnb
18th May 2005, 14:40
Dear Jatin

What I have experienced in baan is that you can't change colors of the text fields, labels etc using 4gl. The functions mentioned by Sanjay are definitley available but have no impact. Probably they might work with the 3gl scrip while creating windows, push buttons, list boxes etc.

Davendra :)

jatin_sanghi
18th May 2005, 15:31
Hi Sanjay and Davendra sir,

RGB() is not able to assign a colour to a particular report field.

Is there any other way by which we can get the desired results.

Jatin

Hitesh Shah
18th May 2005, 15:45
The function bg$ can help u print in different colors e.g. u can print string variable var2 in different colors as indicated in the example here.


if var1 < 1000 then
var2 = bg$(cw.red) & str$(var1) & bg$(cw.black) |string
else
var2 = bg$(cw.blue) & str$(var1) & bg$(cw.black) |string
endif

jatin_sanghi
19th May 2005, 08:21
Hi Hitesh,

Thanx for ur reply...

But this also doesn't seems to work.....what s happeing instead of channg the background colour of a particular report field it is changing it for entire rport.

Is there something tha i'am doig wrong..b'cus i'am trying the similar script as ur example.

Plz...give ur suggesions.

regards,
Jatin

Hitesh Shah
20th May 2005, 07:27
I can say only 2 things.

1.Length of string variable var2 should be large enough to accomodate last
bg$(cw.black). Then this should not be a problem.

2. Try cw.white instead of cw.black . Normal report fields are white . So this should work.

Joy Conner
22nd May 2012, 20:05
I have tried bg$() and it works when output is display but it does not work when output is to windows device.

~Vamsi
5th June 2012, 18:14
If I remember correctly bg$ sets the background color. Follow Hitesh's advice and replace all bg$ with fg$ (foreground) and post your outcome.