diff --git a/lcl/editbtn.pas b/lcl/editbtn.pas index 59751ca0bb..0a7d534452 100644 --- a/lcl/editbtn.pas +++ b/lcl/editbtn.pas @@ -349,12 +349,12 @@ type function CreateDialog(AKind: TDialogKind): TCommonDialog; virtual; procedure SaveDialogResult(AKind: TDialogKind; D: TCommonDialog); virtual; procedure ButtonClick; override; - procedure RunDialog; virtual; procedure EditChange; override; procedure DoFolderChange(Sender:TObject); virtual; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; + procedure RunDialog; virtual; property AutoSelected; property DialogFiles: TStrings read FDialogFiles; published @@ -454,10 +454,10 @@ type function CreateDialog: TCommonDialog; virtual; function GetDialogResult(D : TCommonDialog) : String; virtual; procedure ButtonClick; override; - procedure RunDialog; virtual; public property AutoSelected; constructor Create(AOwner: TComponent); override; + procedure RunDialog; virtual; published // TDirectory properties. property Directory: String read GetDirectory write SetDirectory; @@ -771,9 +771,9 @@ type function GetDefaultGlyph: TBitmap; override; function GetDefaultGlyphName: String; override; procedure ButtonClick; override; - procedure RunDialog; virtual; public constructor Create(AOwner: TComponent); override; + procedure RunDialog; virtual; property AutoSelected; published // CalcEdit properties @@ -1480,7 +1480,6 @@ begin Result:=TSelectDirectoryDialog(D).FileName; end; - procedure TDirectoryEdit.ButtonClick; begin inherited ButtonClick; diff --git a/lcl/grids.pas b/lcl/grids.pas index 9b7801d5e8..d7468d81b3 100644 --- a/lcl/grids.pas +++ b/lcl/grids.pas @@ -1254,6 +1254,7 @@ type procedure AutoAdjustColumns; virtual; procedure BeginUpdate; function CellRect(ACol, ARow: Integer): TRect; + function CellRectValid(ACol, ARow: Integer; out ARect: TRect): Boolean; function CellToGridZone(aCol,aRow: Integer): TGridZone; procedure CheckPosition; procedure Clear; @@ -3393,12 +3394,18 @@ begin end; end; -{ Returns a reactagle corresponding to a fisical cell[aCol,aRow] } +{ Returns a reactagle corresponding to a physical cell[aCol,aRow] } function TCustomGrid.CellRect(ACol, ARow: Integer): TRect; begin - //Result:=ColRowToClientCellRect(aCol,aRow); - ColRowToOffset(True, True, ACol, Result.Left, Result.Right); - ColRowToOffSet(False,True, ARow, Result.Top, Result.Bottom); + Assert( (AColnil) then begin @@ -8148,9 +8156,11 @@ begin FEditor.Dispatch(Msg); // send editor bounds - CellR:=CellRect(FCol,FRow); + PosValid := CellRectValid(FCol, FRow, CellR); + if not PosValid then // Can't position editor; ensure sane values + CellR := Rect(0,0,FEditor.Width, FEditor.Height); - if (CellR.TopFGCache.ClientHeight) or + if not PosValid or (CellR.TopFGCache.ClientHeight) or (UseRightToLeftAlignment and ((CellR.Right-1>FlipX(FGCache.FixedWidth)) or (CellR.Right<0))) or (not UseRightToLeftAlignment and ((CellR.LeftFGCache.ClientWidth))) then