Update of /cvsroot/jvcl/dev/JVCL3/examples/JvAppHotKey
In directory sc8-pr-cvs1:/tmp/cvs-serv4702/JVCL3/examples/JvAppHotKey
Added Files:
JvAppHotKeyDemo.dof JvAppHotKeyDemo.dpr JvAppHotKeyDemo.res
JvAppHotKeyDemoMainFormU.dfm JvAppHotKeyDemoMainFormU.pas
Log Message:
- Copied jvcl/devtools and jvcl/examples dev/JVCL3
- Copied JVCLConvert *.dat files to dev/JVCL3/converter
--- NEW FILE: JvAppHotKeyDemo.dof ---
[Directories]
OutputDir=..\..\Bin
UnitOutputDir=..\..\Dcu
SearchPath=..\..\Source;..\..\Common
--- NEW FILE: JvAppHotKeyDemo.dpr ---
program JvAppHotKeyDemo;
uses
Forms,
JvAppHotKeyDemoMainFormU in 'JvAppHotKeyDemoMainFormU.pas' {JvAppHotKeyDemoMainForm};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TJvAppHotKeyDemoMainForm, JvAppHotKeyDemoMainForm);
Application.CreateForm(TJvAppHotKeyDemoMainForm, JvAppHotKeyDemoMainForm);
Application.Run;
end.
--- NEW FILE: JvAppHotKeyDemo.res ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: JvAppHotKeyDemoMainFormU.dfm ---
object JvAppHotKeyDemoMainForm: TJvAppHotKeyDemoMainForm
Left = 360
Top = 165
Width = 348
Height = 333
Caption = 'JvAppHotKey demo'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Shell Dlg 2'
Font.Style = []
OldCreateOrder = False
Position = poDesktopCenter
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 8
Top = 56
Width = 95
Height = 13
Caption = 'Application &hot key:'
end
object Label2: TLabel
Left = 8
Top = 16
Width = 323
Height = 26
Anchors = [akLeft, akTop, akRight, akBottom]
Caption =
'Define a hot key and switch to another application. Press the ho' +
'tkey to see the effect of TJvApplicationHotKey.'
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object HotKey1: THotKey
Left = 8
Top = 72
Width = 241
Height = 19
Anchors = [akLeft, akTop, akRight]
HotKey = 49217
InvalidKeys = [hcNone, hcShift]
Modifiers = [hkCtrl, hkAlt]
TabOrder = 0
end
object btnAdd: TButton
Left = 256
Top = 70
Width = 75
Height = 24
Anchors = [akTop, akRight]
Caption = '&Add'
Default = True
TabOrder = 1
OnClick = btnAddClick
end
object lbHotKeys: TListBox
Left = 8
Top = 104
Width = 324
Height = 186
Anchors = [akLeft, akTop, akRight, akBottom]
ItemHeight = 13
TabOrder = 2
end
end
--- NEW FILE: JvAppHotKeyDemoMainFormU.pas ---
unit JvAppHotKeyDemoMainFormU;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, JvComponent, JvAppHotKey, StdCtrls, ComCtrls;
type
TJvAppHotKeyDemoMainForm = class(TForm)
HotKey1: THotKey;
Label1: TLabel;
btnAdd: TButton;
lbHotKeys: TListBox;
Label2: TLabel;
procedure btnAddClick(Sender: TObject);
private
procedure DoHotKey(Sender: TObject);
end;
var
JvAppHotKeyDemoMainForm: TJvAppHotKeyDemoMainForm;
implementation
uses
Menus;
{$R *.dfm}
procedure TJvAppHotKeyDemoMainForm.DoHotKey(Sender:TObject);
begin
Application.BringToFront;
ShowMessage(Format('HotKey "%s" pressed!',[ShortCutToText((Sender as TJvApplicationHotKey).HotKey)]));
end;
procedure TJvAppHotKeyDemoMainForm.btnAddClick(Sender: TObject);
var S:string;
begin
S := ShortCutToText(HotKey1.HotKey);
if lbHotKeys.Items.IndexOf(S) > -1 then
begin
ShowMessage('Hot key already assigned!');
Exit;
end;
with TJvApplicationHotKey.Create(self) do
begin
HotKey := HotKey1.HotKey;
Active := true;
OnHotKey := DoHotKey;
lbHotKeys.Items.Add(S);
end;
end;
end.
|