PDA

View Full Version : تعریف کلید میانبر توسط کاربر



nasr
سه شنبه 28 آبان 1387, 15:13 عصر
سلام

من میخوام توی برنامه کاربر خودش مشخص کنه که مثلا با زدن کلید F6 کدام فرم باز بشه.

ممنون

mossaferin
سه شنبه 28 آبان 1387, 21:10 عصر
سلام


unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ActnList,menus;

type
TForm1 = class(TForm)
ActionList1: TActionList;
Button1: TButton;
Action1: TAction;
procedure Button1Click(Sender: TObject);
procedure test(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
ac
Action1.OnExecute:=test;
Action1.ShortCut:=texttoshortcut('Ctrl+A');
end;

procedure TForm1.test(Sender: TObject);
begin
ShowMessage('test');
end;

end.
این یه نمونه کد که در حین اجرای برنامه یه کلید میانبر رو به یه ایونت و اکشن مرتبط میکنه

در ضمن یه سری به فولدر دمو توی فولدر دلفی بزن یه چیزهایی هم اونجا میتونی پیداکنی
موفق باشی