mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 06:39:12 +02:00
Converter: Improve StringGrid's popup menu behavior. Make grid's name shorter.
git-svn-id: trunk@25997 -
This commit is contained in:
parent
919e928e2c
commit
f7eabc0679
@ -423,7 +423,7 @@ var
|
|||||||
GridUpdater: TGridUpdater;
|
GridUpdater: TGridUpdater;
|
||||||
begin
|
begin
|
||||||
RNForm:=TReplaceNamesForm.Create(nil);
|
RNForm:=TReplaceNamesForm.Create(nil);
|
||||||
GridUpdater:=TGridUpdater.Create(fSettings.ReplaceUnits, RNForm.NamePairGrid);
|
GridUpdater:=TGridUpdater.Create(fSettings.ReplaceUnits, RNForm.Grid);
|
||||||
try
|
try
|
||||||
RNForm.Caption:=lisConvUnitsToReplace;
|
RNForm.Caption:=lisConvUnitsToReplace;
|
||||||
GridUpdater.MapToGrid;
|
GridUpdater.MapToGrid;
|
||||||
@ -441,7 +441,7 @@ var
|
|||||||
GridUpdater: TGridUpdater;
|
GridUpdater: TGridUpdater;
|
||||||
begin
|
begin
|
||||||
RNForm:=TReplaceNamesForm.Create(nil);
|
RNForm:=TReplaceNamesForm.Create(nil);
|
||||||
GridUpdater:=TGridUpdater.Create(fSettings.ReplaceTypes, RNForm.NamePairGrid);
|
GridUpdater:=TGridUpdater.Create(fSettings.ReplaceTypes, RNForm.Grid);
|
||||||
try
|
try
|
||||||
RNForm.Caption:=lisConvTypesToReplace;
|
RNForm.Caption:=lisConvTypesToReplace;
|
||||||
GridUpdater.MapToGrid;
|
GridUpdater.MapToGrid;
|
||||||
|
@ -3,14 +3,14 @@ object ReplaceNamesForm: TReplaceNamesForm
|
|||||||
Height = 472
|
Height = 472
|
||||||
Top = 438
|
Top = 438
|
||||||
Width = 343
|
Width = 343
|
||||||
ActiveControl = NamePairGrid
|
ActiveControl = Grid
|
||||||
Caption = 'Properties and Types to replace'
|
Caption = 'Properties and Types to replace'
|
||||||
ClientHeight = 472
|
ClientHeight = 472
|
||||||
ClientWidth = 343
|
ClientWidth = 343
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '0.9.29'
|
LCLVersion = '0.9.29'
|
||||||
object NamePairGrid: TStringGrid
|
object Grid: TStringGrid
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 434
|
Height = 434
|
||||||
Top = 0
|
Top = 0
|
||||||
@ -28,12 +28,12 @@ object ReplaceNamesForm: TReplaceNamesForm
|
|||||||
Width = 170
|
Width = 170
|
||||||
end>
|
end>
|
||||||
FixedCols = 0
|
FixedCols = 0
|
||||||
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goSmoothScroll]
|
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goDrawFocusSelected, goEditing, goSmoothScroll]
|
||||||
PopupMenu = PopupMenu1
|
PopupMenu = PopupMenu1
|
||||||
RowCount = 2
|
RowCount = 2
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnEditingDone = NamePairGridEditingDone
|
OnEditingDone = GridEditingDone
|
||||||
OnSetEditText = NamePairGridSetEditText
|
OnSetEditText = GridSetEditText
|
||||||
ColWidths = (
|
ColWidths = (
|
||||||
169
|
169
|
||||||
170
|
170
|
||||||
@ -103,6 +103,7 @@ object ReplaceNamesForm: TReplaceNamesForm
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
object PopupMenu1: TPopupMenu
|
object PopupMenu1: TPopupMenu
|
||||||
|
OnPopup = PopupMenu1Popup
|
||||||
left = 131
|
left = 131
|
||||||
top = 91
|
top = 91
|
||||||
object InsertRow1: TMenuItem
|
object InsertRow1: TMenuItem
|
||||||
|
@ -47,15 +47,16 @@ type
|
|||||||
HelpButton: TBitBtn;
|
HelpButton: TBitBtn;
|
||||||
InsertRow1: TMenuItem;
|
InsertRow1: TMenuItem;
|
||||||
DeleteRow1: TMenuItem;
|
DeleteRow1: TMenuItem;
|
||||||
NamePairGrid: TStringGrid;
|
Grid: TStringGrid;
|
||||||
PopupMenu1: TPopupMenu;
|
PopupMenu1: TPopupMenu;
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure InsertRow1Click(Sender: TObject);
|
procedure InsertRow1Click(Sender: TObject);
|
||||||
procedure DeleteRow1Click(Sender: TObject);
|
procedure DeleteRow1Click(Sender: TObject);
|
||||||
procedure NamePairGridEditingDone(Sender: TObject);
|
procedure GridEditingDone(Sender: TObject);
|
||||||
procedure NamePairGridSetEditText(Sender: TObject; ACol, ARow: Integer;
|
procedure GridSetEditText(Sender: TObject; ACol, ARow: Integer;
|
||||||
const Value: string);
|
const Value: string);
|
||||||
procedure btnOKClick(Sender: TObject);
|
procedure btnOKClick(Sender: TObject);
|
||||||
|
procedure PopupMenu1Popup(Sender: TObject);
|
||||||
private
|
private
|
||||||
IsLasRow: Boolean;
|
IsLasRow: Boolean;
|
||||||
public
|
public
|
||||||
@ -203,19 +204,29 @@ begin
|
|||||||
IsLasRow:=false;
|
IsLasRow:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TReplaceNamesForm.PopupMenu1Popup(Sender: TObject);
|
||||||
|
var
|
||||||
|
ControlCoord, NewCell: TPoint;
|
||||||
|
begin
|
||||||
|
ControlCoord := Grid.ScreenToControl(PopupMenu1.PopupPoint);
|
||||||
|
NewCell:=Grid.MouseToCell(ControlCoord);
|
||||||
|
Grid.Col:=NewCell.X;
|
||||||
|
Grid.Row:=NewCell.Y;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TReplaceNamesForm.InsertRow1Click(Sender: TObject);
|
procedure TReplaceNamesForm.InsertRow1Click(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
NamePairGrid.InsertColRow(False, NamePairGrid.Row);
|
Grid.InsertColRow(False, Grid.Row);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TReplaceNamesForm.DeleteRow1Click(Sender: TObject);
|
procedure TReplaceNamesForm.DeleteRow1Click(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
NamePairGrid.DeleteColRow(False, NamePairGrid.Row);
|
Grid.DeleteColRow(False, Grid.Row);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Add rows automatically to the end of the grid
|
// Add rows automatically to the end of the grid
|
||||||
// using OnSetEditText and OnEditingDone handlers and IsLasRow flag.
|
// using OnSetEditText and OnEditingDone handlers and IsLasRow flag.
|
||||||
procedure TReplaceNamesForm.NamePairGridEditingDone(Sender: TObject);
|
procedure TReplaceNamesForm.GridEditingDone(Sender: TObject);
|
||||||
var
|
var
|
||||||
sg: TStringGrid;
|
sg: TStringGrid;
|
||||||
begin
|
begin
|
||||||
@ -226,7 +237,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TReplaceNamesForm.NamePairGridSetEditText(Sender: TObject; ACol,
|
procedure TReplaceNamesForm.GridSetEditText(Sender: TObject; ACol,
|
||||||
ARow: Integer; const Value: string);
|
ARow: Integer; const Value: string);
|
||||||
begin
|
begin
|
||||||
if ARow = (Sender as TStringGrid).RowCount-1 then
|
if ARow = (Sender as TStringGrid).RowCount-1 then
|
||||||
|
Loading…
Reference in New Issue
Block a user