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

How to change background color of a control in the datawindow

3,395 views
Skip to first unread message

Tiziano

unread,
Oct 8, 2004, 6:06:22 AM10/8/04
to
Hello!,
My aim is to change background color of the focused control in a datawindow.
At the ItemFocusChanged event of the datawindow I Write:
DW_1.MODIFY(OBJect_Name + ".Background.color = RGB(0, 0, 0)")
ObjectName is the name of the control (column) but such does not work.
Syntax Error.
My question is which is the code and if there are another way to change
dinamically backcolor when
the control take focus. Maybe in the datawindow painter
Thanks
Tiziano


BMartins

unread,
Oct 8, 2004, 10:01:03 AM10/8/04
to
I did not understand what you realy want but, is this:
- If you only want change focus of a colunm, text or compute fild use
SetColumn method (DataWindows), and/or code itemfocuschanged(ing) events.
You can't forget to use properties like edit, edit mask (FocusRectangle),
background color, font (all atributes), etc. In compute expressions of the
properties, you can use isSelected() function and others to make changes.

- If you want to change the row focus, use SetRowFocusIndicator method
(DataWindows) to choose whith kind of focus you want, than use setrow and
selectrow methods and code rowfocuschanged(ing) events.

Regards
BMartins

"Tiziano" <tizian...@nebtech.com> escreveu na mensagem
news:4166669e@forums-1-dub...

Tiziano

unread,
Oct 8, 2004, 10:53:17 AM10/8/04
to
I try to explay better which is my aim.
When the user click on the control inside the datawindow (for example on a
single line edit control) I would like
to change the background color. When the user leave the control I would like
to change the background color.
It seems that simple write DW_1.MODIFY("textbox1.Background.color = RGB(0,
0, 0)") in the itemfocuschanged to be enought but I receive error sintax.
Thanks
Tiziano


"BMartins" <bea...@pred.com.br> ha scritto nel messaggio
news:41669d9f@forums-1-dub...

BMartins

unread,
Oct 8, 2004, 11:20:47 AM10/8/04
to
What sintax error? I usually uses this sintax

ls_ret = dw_1.Modify("textbox1.background.color=12632256")
ls_ret = dw_1.Modify("textbox1.background.color=0") // the color is in
number not with rgb in your case use zero.
if ls_ret <> '' then messagebox('Error',ls_ret)

For colunms I use colunm name.

Regards
BMartins

"Tiziano" <tizian...@nebtech.com> escreveu na mensagem

news:4166a9d9@forums-2-dub...

ALP

unread,
Oct 11, 2004, 4:51:14 AM10/11/04
to
Not sure but try :
DW_1.MODIFY(OBJect_Name + '.Background.color="0~tRGB(0, 0, 0)"')
because if you use an expression, you must first tell to pb what type of
data attribute is !

"Tiziano" <tizian...@nebtech.com> a écrit dans le message de news:
4166669e@forums-1-dub...

Jim Smith

unread,
Oct 11, 2004, 11:41:07 AM10/11/04
to
Try this:

In the datawindow object Place this code in the expression for the color
property:

if( currentRow(), RGB(0, 255, 255), RGB(255, 255, 255) )
CYAN WHITE


Place this this in the object on the data window you wish to change.
For objects = Text tab, Background Color property.
For DW Band = Select the appropriate band and General tab, color property.

This is easier than palcing it in the event script.

I hope this helps.

Jim

On 11 Oct 2004 01:51:14 -0700,
in sybase.public.powerbuilder.datawindow

Jim Smith
EMail: jrsmith AT duglight DOT com

0 new messages