Subject Re: [IBO]Desperate for D6 Help
Author Geoff Worboys
Hi Paul,

> I had made a change to TIB_Grid which looked innocent enough
> but removing it removed the problem.

No change to the grid is innocent... just ask Jason. I doubt
if there is any visual control in the system that has caused
as much trouble as the grid.

> I am attempting to create a derivitive of TIB_Grid which
> changes the height of each row according to the amount of
> text in a memo field obtained via an OnGetRowHeight event.
> The above is all it needs to access violate when placed on a
> form, I call it in DrawCell but it violates without that code.

> Any idea why this doesn't work?

Because drawing the grid is not the only place the row height
is used. Take a look, for example, at the VisibleGridRows
function and the places that is called from.

There is a RowHeights[Index: Longint] property in TCustomGrid
that you could use in your derivative. (Jason does not make
the property public in TIB_CustomGrid because he does not
support variable height rows... you are discovering why not.)

I suggest you do NOT try to change a rowheight while drawing,
as I expect that a change in rowheight will generate an
invalidate or repaint. You could try doing it in response to
the OnTopLeftChanged event (as the grid scrolls you alter
the rowheights... I think that makes sense but have not played
with it myself).

You will run into other problems (scrollbar sync etc etc). But
if you have the time to spend on it... and you will need lots
of time because no change to the grid is innocent or simple;
variable height rows least of all.

(If you work out how to do it then I imagine Jason may be
interested in seeing the result.)

Geoff Worboys
Telesis Computing