Board index » delphi » Why some controls cannot be used with TDBCtrlGrid

Why some controls cannot be used with TDBCtrlGrid

Hello,

I wanted to rearrange one window in my app so that it would use
TDBCtrlGrid component.
Unfortunately the DBCtrlGrid doesn't want to accept a TDBRadioGroup
control. Why ?
I unterstand that it makes no sense to use, for instance, TDBGrid
with TDBCtrlGrid, but what's wrong with TDBRadioGroup ? It's a very
useful control because of its "values" property which enables me
to store user choice as integer field, but display to the user
more descriptive labels (Items). By the way - it would be very nice
if the TDBComboBox had Values property - taken into account if the
style is set to csDropDownList.

--
Zbigniew Lipinski
z...@NOSPAM.webmedia.pl
http://www.webmedia.pl/zl1

 

Re:Why some controls cannot be used with TDBCtrlGrid


Quote
> Unfortunately the DBCtrlGrid doesn't want to accept a TDBRadioGroup
> control. Why ?

Well, I already know that it's because TDBRadioGroup doean't have
csReplicatable in its ControlStyle. But why is like that ?

I have written a descendant of TDBRadioGroup with csRaplicatable
included in ControlStyle. DBCtrlGrid accepts it, when it's empty
(with no radio buttons.) When I'm trying to add something to
the Items property, DBCtrlGrid again raises exception.
OK, TRadioButton is also not csReplicatable. But again, whu it isn't ?

Re:Why some controls cannot be used with TDBCtrlGrid


Zbigniew,

  the reason is that controls which use csReplicatable have to implement the
PaintTo method, which enables them to paint properly when replicated.  Check
out the Delphi source for examples in controls which do this.

I have to say, I've tried to imitate this in another control, but I gave up!
It was rather tricky - or so I thought at the time.

If anyone's got a good example of how to do this, I'd also be interested.

Regards,

Matt P.
Domesday Project.

Quote
Zbigniew Lipinski <z...@NOSPAMwebmedia.pl> wrote in message

news:01bf061d$c7e8bc40$LocalHost@zbigniel...
Quote

Re:Why some controls cannot be used with TDBCtrlGrid


(Replying second time as the first message seems to have disappeared)

Quote
> I have to say, I've tried to imitate this in another control, but I gave
up!
> It was rather tricky - or so I thought at the time.

That's a problem ! I really need TDBRadioGroup very much. Will try to solve
this,
perhaps I'll have more luck (or maybe no....).

Quote
> If anyone's got a good example of how to do this, I'd also be interested.

Me too !

Thank you for your response.

Z.L.

Re:Why some controls cannot be used with TDBCtrlGrid


Zbigniew,

  I've looked into it further.  For a component to deal with DBCtrlGrids, it
has to handle the CM_GETDATALINK message, setting the Msg.Result to be the
DataLink.  This will work and allow you to insert the dbradiogroup onto the
control grid (I know - I've done it).

 BUT - as soon as you attempt to add any radio buttons, you'll get the same
problem because the Radio Buttons themselves don't handle this message, and
don't have the csReplicatable controlstyle!

I was hoping there was some simple way of creating a descendant component,
but it looks as if you'd have to pull most of code for radiobuttons,
radiogroups and dbRadiocontrols just to re-implement it so that the radio
button had the correct properties.

Looks possible, but very, very boring work.

Regards,

Matt P
Domesday Project.

PS. I may have been wrong about the PaintTo procedure - I can definitely
remember it had something to do with dbCtrlGrid - but for the life of me I
can't remember what.

Quote
Zbigniew Lipinski <z...@NOSPAM.webmedia.pl> wrote in message

news:01bf0697$90a4a1c0$58a7ccc2@zl...
Quote

Re:Why some controls cannot be used with TDBCtrlGrid


Quote
> I was hoping there was some simple way of creating a descendant
component,
> but it looks as if you'd have to pull most of code for radiobuttons,
> radiogroups and dbRadiocontrols just to re-implement it so that the radio
> button had the correct properties.

> Looks possible, but very, very boring work.

You are right, I have already tried this. I'll probably end up using
a normal TDBGrid as I'm short of time.

Thanks for the discussion.

--
Zbigniew Lipinski
z...@NOSPAM.webmedia.pl
www.webmedia.pl/zl1

Other Threads