Subject | Re: [IBO] TIB_Grid Bug |
---|---|
Author | TeamIBO |
Post date | 2002-02-12T23:22:34Z |
Hi Oliver,
Thanks for the demo app, I would never have found the problem without
it. The bug relates to a work-around that was implemented in IB_Grid
to overcome some issues with the VCL TCustomGrid class.
I will forward the updated unit to Jason when he returns. If you want
to wait the fix will be in a future release, if you want to fix it
yourself then...
Edit IB_Grid.pas and alter the following procedure as shown...
procedure TIB_CustomGrid.Paint;
var
// oldFEditorMode: boolean; // <<<<< not needed
...
begin
...
// oldFEditorMode := EditorMode; // <<<<< not needed
oldBufRow := DataLink.BufferRecord;
try
THackCustomGrid( Self ).FEditorMode := false;
inherited Paint;
finally
// THackCustomGrid( Self ).FEditorMode := oldFEditorMode; // <<<<
if Assigned(InplaceEditor) and // <<<<< added
InplaceEditor.HandleAllocated and // <<<<< added
InplaceEditor.Visible then // <<<<< added
THackCustomGrid( Self ).FEditorMode := true // <<<<< added
else // <<<<< added
THackCustomGrid( Self ).FEditorMode := false; // <<<<< added
DataLink.BufferRecord := oldBufRow;
end;
...
end;
Explanation:
Previously the paint code was forcing FEditorMode to false and then
resetting to its old value when the inherited procedure returned. The
problem is that FEditorMode may get explicitly set during cell
drawing, and so the reset on return is inappropriate and leaves things
out of sync.
Looking in TCustomGrid it is apparent that FEditorMode is supposed to
follow the availability of the inplace editor (set true with
ShowEditor and set false with HideEditor), so the new code above
resyncs the FEditorMode status accordingly.
If the above is not clear I can send you the updated unit directly
(provided you are using IBO4.2.Fr).
--
Geoff Worboys - TeamIBO
Telesis Computing
Thanks for the demo app, I would never have found the problem without
it. The bug relates to a work-around that was implemented in IB_Grid
to overcome some issues with the VCL TCustomGrid class.
I will forward the updated unit to Jason when he returns. If you want
to wait the fix will be in a future release, if you want to fix it
yourself then...
Edit IB_Grid.pas and alter the following procedure as shown...
procedure TIB_CustomGrid.Paint;
var
// oldFEditorMode: boolean; // <<<<< not needed
...
begin
...
// oldFEditorMode := EditorMode; // <<<<< not needed
oldBufRow := DataLink.BufferRecord;
try
THackCustomGrid( Self ).FEditorMode := false;
inherited Paint;
finally
// THackCustomGrid( Self ).FEditorMode := oldFEditorMode; // <<<<
if Assigned(InplaceEditor) and // <<<<< added
InplaceEditor.HandleAllocated and // <<<<< added
InplaceEditor.Visible then // <<<<< added
THackCustomGrid( Self ).FEditorMode := true // <<<<< added
else // <<<<< added
THackCustomGrid( Self ).FEditorMode := false; // <<<<< added
DataLink.BufferRecord := oldBufRow;
end;
...
end;
Explanation:
Previously the paint code was forcing FEditorMode to false and then
resetting to its old value when the inherited procedure returned. The
problem is that FEditorMode may get explicitly set during cell
drawing, and so the reset on return is inappropriate and leaves things
out of sync.
Looking in TCustomGrid it is apparent that FEditorMode is supposed to
follow the availability of the inplace editor (set true with
ShowEditor and set false with HideEditor), so the new code above
resyncs the FEditorMode status accordingly.
If the above is not clear I can send you the updated unit directly
(provided you are using IBO4.2.Fr).
--
Geoff Worboys - TeamIBO
Telesis Computing