Board index » delphi » Controls on TDBCtrlGrid

Controls on TDBCtrlGrid

Hi,

Can anyone please shed some lighyt:

I have an application that contains a TDBCtrlgrid with a few TDBEdit's on
it.
In design mode I have set the color to clgreen. However, in my application I
have a setup form, that allows the user to change colors, fonts, etc of
certain controls.

However, I can't seem to be able to change the color of the DBEdit's that
reside on the DBCtrlGrid during runtime.

I thought by changing DBEdit1.color on formcreate would then cause all the
DBEdit's on the ctrlgrid that show up for every record (that are formed from
the original DB Grid) to be the new color, but it still defaults to green
(Green is the color set in design mode).

Please help...

TIA
Adam.

 

Re:Controls on TDBCtrlGrid


Quote
"Adam H." <ah...@netconnect.com.au> wrote in message

news:3bc22271_2@dnews...

Quote
> Hi,

> Can anyone please shed some lighyt:

> I have an application that contains a TDBCtrlgrid with a few TDBEdit's on
> it.
> In design mode I have set the color to clgreen. However, in my application
I
> have a setup form, that allows the user to change colors, fonts, etc of
> certain controls.

> However, I can't seem to be able to change the color of the DBEdit's that
> reside on the DBCtrlGrid during runtime.

> I thought by changing DBEdit1.color on formcreate would then cause all the
> DBEdit's on the ctrlgrid that show up for every record (that are formed
from
> the original DB Grid) to be the new color, but it still defaults to green
> (Green is the color set in design mode).

Have you tried posting a message to the form in the OnCreate event so you
can make sure the TDBCtrlGrid is streamed completely before changing the
color?

Woody

Re:Controls on TDBCtrlGrid


Hi Woody,

Quote
> Have you tried posting a message to the form in the OnCreate event so you
> can make sure the TDBCtrlGrid is streamed completely before changing the
> color?

Yes. But it doesn't seem to make any difference. The exact script is:

procedure TFormTickets.FormCreate(Sender: TObject);
var
i : integer;
begin
  for I := 0 to self.componentcount - 1 do // Iterate
    if self.components[i].tag = 494 then
    begin
      (self.components[i] as TDbEdit).Color :=
formsetup.CLWeightBG.colorvalue;
      (self.components[i] as TDbEdit).font.color :=
formsetup.CLWeightFont.colorvalue;
    end;
end;

Re:Controls on TDBCtrlGrid


My Apologies woody,

The oncreate did work, however I had to change another part of my program
first. (There was another line of code in a different unit resetting the
colors back to the original color).

Thanks for your help...

Adam.

Quote
"Woody" <woody....@ih2000.net> wrote in message news:3bc34542$1_2@dnews...
> "Adam H." <ah...@netconnect.com.au> wrote in message
> news:3bc22271_2@dnews...
> > Hi,

> > Can anyone please shed some lighyt:

> > I have an application that contains a TDBCtrlgrid with a few TDBEdit's
on
> > it.
> > In design mode I have set the color to clgreen. However, in my
application
> I
> > have a setup form, that allows the user to change colors, fonts, etc of
> > certain controls.

> > However, I can't seem to be able to change the color of the DBEdit's
that
> > reside on the DBCtrlGrid during runtime.

> > I thought by changing DBEdit1.color on formcreate would then cause all
the
> > DBEdit's on the ctrlgrid that show up for every record (that are formed
> from
> > the original DB Grid) to be the new color, but it still defaults to
green
> > (Green is the color set in design mode).

> Have you tried posting a message to the form in the OnCreate event so you
> can make sure the TDBCtrlGrid is streamed completely before changing the
> color?

> Woody

Other Threads