Subject Re: [IBO] TIB_Grid problem with D2009
Author Jason Wharton
> There seems to be a problem with TIB_Grid and D2009 which results in an
> access violation.
>
> All you need to do is start a new project and put a TIB_Grid on a form and
> you will get the AV when you close the form, whether the grid is linked up
> to a TIB_Query etc. or not.
>
> I am using IBObjects version 4.9.2. and my D2009 has all the latest
> updates.
>
> Please let me know if any more info. would help.


There is a place in the code where I have to hack into the private variables
of the TCustomGrid class. I had not yet applied the pattern for the
variables according to how they are in Delphi 2009. They were changed and so
I was corrupting the internal variables. The next release should definitely
resolve these problems. For details please see THackCustomGrid. If you want
to change the sources you have now please put this code in place of the
existing one around line 3050 in IB_Grid.pas:


{$HINTS OFF}
type
{$IFNDEF IBO_SUPPORTED_COMPILER}
// There is the risk that the VCL could change this structure which would
// cause bugs! Please verify the version of the VCL with all versions of the
// compiler. Hopefully the VCL will remain the same per each version of the
// compiler too. Otherwise, I'll have to figure some other way to do this
right.
THackCustomGrid = class( TClassThatDoesNotExistToForceCompilerError )
end;
{$ENDIF}

{ This is used to suppress scrollbar flicker while
}
{
}
{ It is also used to force the DrawCell method to get called for the
cused }
{ cell since there is some assumptions made that we don't
}

THackCustomGrid = class( TCustomControl )
private
FAnchor: TGridCoord;
FBorderStyle: TBorderStyle;
FCanEditModify: Boolean;
FColCount: Longint;
{$ifdef IBO_VCL2009_OR_GREATER}
FCurrent: TGridCoord;
FDefaultColWidth: Integer;
FDefaultRowHeight: Integer;
FFixedCols: Integer;
FFixedRows: Integer;
FFixedColor: TColor;
FGridLineWidth: Integer;
FOptions: TGridOptions;
FRowCount: Longint;
FScrollBars: TScrollStyle;
FTopLeft: TGridCoord;
FSizingIndex: Longint;
FSizingPos, FSizingOfs: Integer;
FMoveIndex, FMovePos: Longint;
FHitTest: TPoint;
FInplaceEdit: TInplaceEdit;
FInplaceCol, FInplaceRow: Longint;
FColOffset: Integer;
FDefaultDrawing: Boolean;
FEditorMode: Boolean;
{$IF DEFINED(CLR)}
FColWidths: TIntegerDynArray;
FRowHeights: TIntegerDynArray;
FTabStops: TIntegerDynArray;
{$ELSE}
FColWidths: Pointer;
FRowHeights: Pointer;
FTabStops: Pointer;
{$IFEND}
{$else}
FColWidths: Pointer;
FTabStops: Pointer;
FCurrent: TGridCoord;
FDefaultColWidth: Integer;
FDefaultRowHeight: Integer;
FFixedCols: Integer;
FFixedRows: Integer;
FFixedColor: TColor;
FGridLineWidth: Integer;
FOptions: TGridOptions;
FRowCount: Longint;
FRowHeights: Pointer;
FScrollBars: TScrollStyle;
FTopLeft: TGridCoord;
FSizingIndex: Longint;
FSizingPos, FSizingOfs: Integer;
FMoveIndex, FMovePos: Longint;
FHitTest: TPoint;
FInplaceEdit: TInplaceEdit;
FInplaceCol, FInplaceRow: Longint;
FColOffset: Integer;
FDefaultDrawing: Boolean;
FEditorMode: Boolean;
{$endif}
end;
{$HINTS ON}



Kind regards,
Jason Wharton