RxFPC:new procedure - TRxDBGrid.RemoveToolMenuItem

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5910 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2017-05-30 08:25:18 +00:00
parent 592426d585
commit aec5a56e9c
2 changed files with 28 additions and 12 deletions

View File

@ -937,7 +937,8 @@ type
procedure DeSelectAllRows; procedure DeSelectAllRows;
procedure InvertSelection; procedure InvertSelection;
procedure CopyCellValue; procedure CopyCellValue;
procedure CreateToolMenuItem(ShortCut: char; const ACaption: string; MenuAction: TNotifyEvent); function CreateToolMenuItem(ShortCut: char; const ACaption: string; MenuAction: TNotifyEvent):TMenuItem;
procedure RemoveToolMenuItem(MenuAction: TNotifyEvent);
procedure SetSort(AFields: array of String; ASortMarkers: array of TSortMarker; PreformSort: Boolean = False); procedure SetSort(AFields: array of String; ASortMarkers: array of TSortMarker; PreformSort: Boolean = False);
@ -3036,17 +3037,32 @@ begin
FFooterOptions.DrawFullLine := Value; FFooterOptions.DrawFullLine := Value;
end; end;
procedure TRxDBGrid.CreateToolMenuItem(ShortCut: char; const ACaption: string; function TRxDBGrid.CreateToolMenuItem(ShortCut: char; const ACaption: string;
MenuAction: TNotifyEvent); MenuAction: TNotifyEvent): TMenuItem;
begin
Result := TMenuItem.Create(F_PopupMenu);
F_PopupMenu.Items.Add(Result);
Result.Caption := ACaption;
if ShortCut <> #0 then
Result.ShortCut := KeyToShortCut(Ord(ShortCut), [ssCtrl]);
Result.OnClick := MenuAction;
end;
procedure TRxDBGrid.RemoveToolMenuItem(MenuAction: TNotifyEvent);
var var
R: TMenuItem; R: TMenuItem;
I: Integer;
begin begin
R := TMenuItem.Create(F_PopupMenu); if not Assigned(MenuAction) then Exit;
F_PopupMenu.Items.Add(R); for I:=F_PopupMenu.Items.Count-1 downto 0 do
R.Caption := ACaption; begin
if ShortCut <> #0 then R:=F_PopupMenu.Items[I];
R.ShortCut := KeyToShortCut(Ord(ShortCut), [ssCtrl]); if R.OnClick = MenuAction then
R.OnClick := MenuAction; begin
F_PopupMenu.Items.Delete(i);
R.Free;
end;
end;
end; end;
procedure TRxDBGrid.DoCreateJMenu; procedure TRxDBGrid.DoCreateJMenu;
@ -5167,8 +5183,8 @@ end;
procedure TRxDBGrid.MoveSelection; procedure TRxDBGrid.MoveSelection;
begin begin
inherited MoveSelection; inherited MoveSelection;
{ if Assigned(FFooterOptions) and FFooterOptions.Active and (FFooterOptions.RowCount > 0) then (* if Assigned(FFooterOptions) and FFooterOptions.Active and (FFooterOptions.RowCount > 0) then
DrawFooterRows;} DrawFooterRows; *)
end; end;
function TRxDBGrid.GetBufferCount: integer; function TRxDBGrid.GetBufferCount: integer;

View File

@ -36,7 +36,7 @@ unit RxDBGridFooterTools;
interface interface
uses uses
Classes, SysUtils, rxdbgrid, Graphics, Grids, Controls; Classes, SysUtils, rxdbgrid, Graphics, Grids, Controls, Menus;
type type