StringGrid editor components are now correctly anchored, suggested by Jarto

git-svn-id: trunk@8424 -
This commit is contained in:
jesus 2006-01-03 21:03:41 +00:00
parent 031f944875
commit ee3c5a89d3

View File

@ -782,8 +782,6 @@ Type
FGrid: TStringGrid; FGrid: TStringGrid;
FFixedColor: TColor; FFixedColor: TColor;
FFixedRows,FFixedCols: Integer; FFixedRows,FFixedCols: Integer;
//procedure OnFixedRows(Sender: TObject);
//procedure OnFixedCols(Sender: TObject);
procedure OnPrepareCanvas(Sender: TObject; Col,Row:Integer; aState: TGridDrawState); procedure OnPrepareCanvas(Sender: TObject; Col,Row:Integer; aState: TGridDrawState);
public public
constructor create(AOwner: TComponent); override; constructor create(AOwner: TComponent); override;
@ -792,17 +790,7 @@ Type
property FixedRows: Integer read FFixedRows write FFixedRows; property FixedRows: Integer read FFixedRows write FFixedRows;
property FixedCols: Integer read FFixedCols write FFixedCols; property FixedCols: Integer read FFixedCols write FFixedCols;
end; end;
{
procedure TStringGridEditorDlg.OnFixedRows(Sender: TObject);
begin
FGrid.FixedRows := FGrid.FixedRows + 1 - 2 * (Sender as TComponent).Tag;
end;
procedure TStringGridEditorDlg.OnFixedCols(Sender: TObject);
begin
FGrid.FixedCols := FGrid.FixedCols + 1 - 2 * (Sender as TComponent).Tag;
end;
}
procedure TStringGridEditorDlg.OnPrepareCanvas(Sender: TObject; procedure TStringGridEditorDlg.OnPrepareCanvas(Sender: TObject;
Col,Row: Integer; aState: TGridDrawState); Col,Row: Integer; aState: TGridDrawState);
begin begin
@ -826,55 +814,28 @@ begin
FGrid.Options:=Fgrid.Options + [goEditing,goColSizing,goRowSizing]; FGrid.Options:=Fgrid.Options + [goEditing,goColSizing,goRowSizing];
FGrid.OnPrepareCanvas := @OnPrepareCanvas; FGrid.OnPrepareCanvas := @OnPrepareCanvas;
FGrid.ExtendedColSizing := True; FGrid.ExtendedColSizing := True;
{ FGrid.Anchors := [akLeft,akTop,akRight,akBottom];
With TButton.Create(Self) do begin
parent:=self;
SetBounds(5, FGrid.Top + Fgrid.Height + 10, 80, 18);
Tag:=0;
Caption:='+ FixedRows';
OnClick:=@OnFixedRows;
end;
With TButton.Create(Self) do begin
parent:=self;
SetBounds(5, FGrid.Top + Fgrid.Height + 30, 80, 18);
Tag:=1;
Caption:='- FixedRows';
OnClick:=@OnFixedRows;
end;
With TButton.Create(Self) do begin
parent:=self;
SetBounds(90, FGrid.Top + Fgrid.Height + 10, 80, 18);
Tag:=0;
Caption:='+ FixedCols';
OnClick:=@OnFixedCols;
end;
With TButton.Create(Self) do begin
parent:=self;
Left:=90;
SetBounds(90, FGrid.Top + Fgrid.Height + 30, 80, 18);
Tag:=1;
Caption:='- FixedCols';
OnClick:=@OnFixedCols;
end;
}
//Bnt Ok //Bnt Ok
With TBitBtn.Create(self) do With TBitBtn.Create(self) do
begin begin
Parent:= self;
Left := 240; Left := 240;
Top := FGrid.Top + Fgrid.Height + 5; Top := FGrid.Top + Fgrid.Height + 5;
Width := 99; Width := 99;
Kind := bkOk; Kind := bkOk;
Parent:= self; Anchors := [akRight, akBottom];
end; end;
//Bnt Cancel //Bnt Cancel
With TBitBtn.Create(self) do With TBitBtn.Create(self) do
begin begin
Parent:= self;
Left := 240; Left := 240;
Top := FGrid.Top + Fgrid.Height + height + 5; Top := FGrid.Top + Fgrid.Height + height + 5;
Width := 99; Width := 99;
Kind := bkCancel; Kind := bkCancel;
Parent:= self; Anchors := [akRight, akBottom];
end; end;
// Save/load buttons // Save/load buttons
@ -899,7 +860,6 @@ begin
AssignGrid(Dlg.FGrid, aGrid, true); AssignGrid(Dlg.FGrid, aGrid, true);
//ShowEditor
if Dlg.ShowModal=mrOK then if Dlg.ShowModal=mrOK then
begin begin
//Apply the modifications //Apply the modifications
@ -924,8 +884,6 @@ begin
DstGrid.Clear; DstGrid.Clear;
Dstgrid.ColCount:=srcGrid.ColCount; Dstgrid.ColCount:=srcGrid.ColCount;
DstGrid.RowCount:=srcGrid.RowCount; DstGrid.RowCount:=srcGrid.RowCount;
//DstGrid.FixedRows:=srcGrid.FixedRows;
//Dstgrid.FixedCols:=srcGrid.FixedCols;
end; end;
for i:=0 to srcGrid.RowCount-1 do for i:=0 to srcGrid.RowCount-1 do
DstGrid.RowHeights[i]:=srcGrid.RowHeights[i]; DstGrid.RowHeights[i]:=srcGrid.RowHeights[i];