| Subject |
Re: Add Color |
| From |
Mervyn Bick <invalid@invalid.invalid> |
| Date |
Sun, 27 Mar 2022 14:53:41 +0200 |
| Newsgroups |
dbase.getting-started |
| Attachment(s) |
color_ef_black.cc, color_ef_white.cc |
On 2022/03/21 02:49, Ivan Benttini wrote:
> Thanks for your time, but I can not make it works. all I want is get the backgroungs of my entryfields to be the same as my form. I will keep looking for someone wanting the same to copy from them of hpw to do this. After my stroke I can only work little bit of the time. Thanks again for trying to again
> help this old crocodile here.
If you look in the Inspector at the colorNormal property of an
entryfield you will see that it is WindowText/Window which, to dBASE,
means black text on a white background.
If you look in the Inspector at the colorNormal property of a form you
will see it is BtnFace.
By simply changing an entryfield's colorNormal property to
WindowText/BtnFace it's background will match the colour of a standard form.
If you have changed the colour of the form use the value assigned to its
colorNormal property in place of BtnFace in the entryfield's colorNormal
property.
Changing the background colour for one entryfield by hand is not a
problem but if you want the background changed for every entryfield it
is better to use a custom entryfield. The two custom controls attached
will match the background color of any form they used on. If you change
the colour of the form the background of the entryfield will change to
match.
If you have used a dark colour for the form black text may be hard to
read and using white instead of WindowText in the entryfield's
colorNormal property may be a better option. color_ef_black.cc has
black text and color_ef_white.cc has white text.
To use the custom entryfield type set procedure to color_ef_black.cc
or set procedure to color_ef_white.cc in the Command Panel. The
custom control will appear in the Custom tab of the Component Palette
and you can drag it onto a form in exactly the same way as any other
component.
The custom entryfields use an onOpen event handler to set the background
colour. If you need to use your own onOpen event handler in your form
for any color_ef entryfield it must contain one of the following lines
depending on which .cc you used.
color_ef_black::onopen()
or
color_ef_white::onopen()
If you don't include the line the entryfield on the form will revert to
black text on a white background.
Mervyn.
|
class COLOR_EF_BLACK(parentObj) of ENTRYFIELD(parentObj) custom
with (this)
onOpen = class::onOpen
height = 1.0
left = 9.2857
top = 5.6364
width = 8.0
metric = 0 // Chars
value = "Color_EF"
endwith
function onOpen
this.colorNormal = 'WindowText/'+this.parent.colorNormal
return
endclass
|
class COLOR_EF_WHITE(parentObj) of ENTRYFIELD(parentObj) custom
with (this)
onOpen = class::onOpen
height = 1.0
left = 9.2857
top = 5.6364
width = 8.0
metric = 0 // Chars
value = "Color_EF"
endwith
function onOpen
this.colorNormal = 'white/'+this.parent.colorNormal
return
endclass
|