In this place you'll locate additional information, that lets you
take advantage more efficient many new possibilities contained in X-Files Components.
Here will be published various tips & tricks and some interesting source code.
If you made any interesting function by using components from this package and you
would to publish it, send out appropriate part of source code and description to
my e-mail.
Troubleshooting
1. Using TXDBGrid component whether the local represents a Middle Eastern locale.
TXDBGrid component implements bdRightToLeft BiDiMode on the platform whether
the local represents a Middle Eastern locale (SysLocale.MiddleEast = True),
but some bugs have been detected in antecesor class (TCustomGrid).
To ensure correct working for TXDBGrid component when SysLocale.MiddleEast
is True and BiDiMode is bdRightToLeft, you need fix the bugs in Grids.pas unit
and add source of the Grids unit to your project. These are the statements from
Grids.pas unit, you need to improve:
The statements located below have been corrected yet by Embarcadero in RAD Studio XE3.
{ Need for Delphi 5, 6, 7, 8, 2005, 2006, 2007, 2009, 2010, XE & XE2 }
function TCustomGrid.CalcCoordFromPoint(X, Y: Integer;
const DrawInfo: TGridDrawInfo): TGridCoord;
...
begin
if not UseRightToLeftAlignment then
Result.X := DoCalc(DrawInfo.Horz, X)
else
Result.X := DoCalc(DrawInfo.Horz, ClientWidth - X); // Added by K.S.
// Result.X := DoCalcRightToLeft(DrawInfo.Horz, X); // Commented by K.S.
Result.Y := DoCalc(DrawInfo.Vert, Y);
end;
The statements located below have been corrected yet by Borland in Delphi 6.
{ Need for Delphi 5 only }
procedure TCustomGrid.CalcSizingState(X, Y: Integer; var State: TGridState;
var Index: Longint; var SizingPos, SizingOfs: Integer;
var FixedInfo: TGridDrawInfo);
procedure CalcAxisState(const AxisInfo: TGridAxisDrawInfo; Pos: Integer;
NewState: TGridState);
var
I, Line, Back, Range: Integer;
begin
if NewState = gsColSizing then // Added by K.S.
if UseRightToLeftAlignment then
Pos := ClientWidth - Pos;
{ Need for Delphi 5 only }
procedure TCustomGrid.MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
...
if FGridState <> gsNormal then
begin
if FGridState = gsColSizing then // Added by K.S.
if UseRightToLeftAlignment then
FSizingPos := ClientWidth - FSizingPos;
DrawSizingLine(DrawInfo);
Exit;
end;
{ Need for Delphi 5 only }
procedure TCustomGrid.MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
...
gsRowSizing, gsColSizing:
begin
CalcDrawInfo(DrawInfo);
DrawSizingLine(DrawInfo);
if FGridState = gsColSizing then // Added by K.S.
if UseRightToLeftAlignment then
FSizingPos := ClientWidth - FSizingPos;
If you'll implement these changes mouse click on fixed columns and row resizing by the user
should work correct for TXDBGrid component and for each TCustomGrid's descendant when SysLocale.MiddleEast
is True and BiDiMode is bdRightToLeft.
Go to the top of this page
2. Using TXDBGrid component when invisible column starts from XDBGrid.ClientWidth.
When the property Visible will be False for the column that starts from XDBGrid.ClientWidth
the Invalidate method work incorrect. When you'll click on several cells, you may see old
and new selection for this cells. These are the statements from Grids.pas unit, you need
to improve:
{ Need for Delphi 5, 6, 7, 8, 2005, 2006, 2007, 2009, 2010, XE, XE2, ... }
procedure TCustomGrid.GridRectToScreenRect(GridRect: TGridRect;
var ScreenRect: TRect; IncludeLine: Boolean);
function LinePos(const AxisInfo: TGridAxisDrawInfo; Line: Integer): Integer;
...
for I := Start to Line - 1 do
begin
Inc(Result, GetExtent(I) + EffectiveLineWidth);
if Result > GridExtent + EffectiveLineWidth then // Added by K.S.
// if Result > GridExtent then // See CalcAxis // Commented by K.S.
begin
Result := 0;
Exit;
end;
Go to the top of this page
Copyright © 1999-2023 X-Files Software