Subject Re: [IBO] IB_Control Grid functionality
Author TeamIBO
> But, should it? I mean.. If I enter one of the fields in the
> selected record... why should that have an effect on the
> non-selected records in the grid?

> I'll accept that its just the way it works, now... but, does that
> really make sense?

I took a look at CtrlGrid source (both VCL and IBO) some time ago. And
when you understand what is happening behind the interface it does all
make sense.

I just now did some experiments and found that, while TDBCtrlGrid does
what you want in some circumstances, it is not reliable either - the
difference between TDBCtrl and TIB_CtrlGrid is only that TIB_CtrlGrid
repaints the entire grid in more circumstances, and so the problem
becomes apparent in more circumstances.

Imagine the following scenario...

You tab onto a control on the grid - the control gets focus and so
sets its color to clAqua or something. Now focus a different
application that covers the form of the testing app, and then focus
the testing app again (this will cause the entire grid to be
repainted without any calls to OnEnter or OnExit).

As part of painting all rows on the grid the same control instance is
used in each and every row - the data is loaded from the dataset
buffer row and the control PaintTo method called to paint to the
particular grid panel. Since you have set the actual control Color
property to clAqua (or whatever) when entering the control (and you
have not exited yet) then every row will be painted with that
property.

This scenario applies to both TDBCtrlGrid and TIB_CtrlGrid. Note that
this also explains why you cannot use RichEdit on CtrlGrid. It does
not have csReplicatable in its ControlStyle property because you
cannot use PaintTo to paint a RichEdit to an particular canvas.


AFAICT the only way to avoid this would to create your own control
derivations in which you change the painting mechanism. Or perhaps
create your own CtrlGrid which first reset the control colors for all
but the current row, and then called PaintTo. I dont know if this
would work or not.

--
Geoff Worboys - TeamIBO
Telesis Computing