home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 September
/
Chip_2001-09_cd1.bin
/
zkuste
/
delphi
/
kolekce
/
d56
/
RMCTL.ZIP
/
rmFormEditBinding.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
2001-06-22
|
2KB
|
80 lines
{================================================================================
Copyright (C) 1997-2001 Mills Enterprise
Unit : rmFormEditBinding
Purpose : dialog form for choosing key binding combinations
Date : 10-26-2000
Author : Ryan J. Mills
Version : 1.80
================================================================================}
unit rmFormEditBinding;
interface
{$I CompilerDefines.INC}
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, Menus;
type
TrmFrmEditBinding = class(TForm)
GroupBox1: TGroupBox;
cbAlt: TCheckBox;
cbCTRL: TCheckBox;
cbShift: TCheckBox;
cbxKey: TComboBox;
Button1: TButton;
Button2: TButton;
private
function GetBinding: TShortcut;
procedure SetBinding(const Value: TShortcut);
{ Private declarations }
public
{ Public declarations }
property Binding:TShortcut read GetBinding write SetBinding default scNone;
end;
implementation
{$R *.DFM}
{ TrmFrmEditBinding }
function TrmFrmEditBinding.GetBinding: TShortcut;
var
wKey : Word;
wShift : TShiftState;
begin
if cbxKey.ItemIndex = 0 then
result := scNone
else
begin
ShortCutToKey(TextToShortCut(cbxKey.Text), wKey, wShift);
wShift := [];
if cbAlt.checked then
wShift := wShift + [ssAlt];
if cbCtrl.checked then
wShift := wShift + [ssCtrl];
if cbShift.checked then
wShift := wShift + [ssShift];
result := ShortCut(wKey, wShift);
end;
end;
procedure TrmFrmEditBinding.SetBinding(const Value: TShortcut);
var
wKey : Word;
wShift : TShiftState;
begin
ShortCutToKey(Value, wkey, wShift);
cbAlt.checked := (ssAlt in wShift);
cbCTRL.checked := (ssCtrl in wShift);
cbShift.checked := (ssShift in wShift);
cbxKey.ItemIndex := cbxKey.items.IndexOf(ShortCutToText(Shortcut(wKey, [])));
end;
end.