1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
unit FMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
UIRibbon, UIRibbonForm, UIRibbonCommands, GraphUtil;
type
TFormMain = class(TForm)
Ribbon: TUIRibbon;
procedure RibbonLoaded(Sender: TObject);
procedure CommandCreated(const Sender: TUIRibbon;
const Command: TUICommand);
private
{ Déclarations privées }
FCmdPaste: TUICommandAction;
FCmdPasteSpecial: TUICommandAction;
FCmdCut: TUICommandAction;
FCmdCopy: TUICommandAction;
procedure Test(const Args: TUICommandActionEventArgs);
public
{ Déclarations publiques }
end;
var
FormMain: TFormMain;
implementation
{$R *.dfm}
uses RibbonMarkup;
procedure TFormMain.Test (const Args: TUICommandActionEventArgs);
begin
ShowMessage('Test');
end;
procedure TFormMain.RibbonLoaded;
begin
inherited;
Color := ColorAdjustLuma(Ribbon.BackgroundColor, -25, False);
end;
procedure TFormMain.CommandCreated(const Sender: TUIRibbon;
const Command: TUICommand);
begin
inherited;
case Command.CommandId of
CmdPaste:
begin
FCmdPaste := Command as TUICommandAction;
FCmdPaste.OnExecute := Test;
end;
CmdPasteSpecial:
begin
FCmdPasteSpecial := Command as TUICommandAction;
FCmdPasteSpecial.SetShortCut([ssCtrl, ssAlt], 'V');
FCmdPasteSpecial.OnExecute := Test;
end;
CmdCut:
begin
FCmdCut := Command as TUICommandAction;
FCmdCut.OnExecute := Test;
end;
CmdCopy:
begin
FCmdCopy := Command as TUICommandAction;
FCmdCopy.OnExecute := Test;
end;
end;
end;
end. |
Partager