was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

48 Visitors Online


 
...multiple sowie nicht vordefinierte Shortcuts mit einer TAction zur Laufzeit verknüpfen?
Autor: Loïs Bégué
Homepage: http://www.arpoon.com
[ Tip ausdrucken ]  

Tip Bewertung (8):  
     


{++++++++++++++++++++++ Deutsch ++++++++++++++++++++++++++++++++++++++++++++
Sie können ein TActionList bzw. TAction benutzen, um verschiedene Shortcuts
einem Menüpunkt oder einem Button zuzuordnen.
Ebenfalls nutzen Sie diesen Tip, um "nicht registrierte" Shortcuts zu nutzen.
Beipiele für nicht registrierte Shortcuts:
[Numpad 1]..[Numpad 0]
[CTRL] + [SHIFT] + [+]
...
+++++++++++++++++++++++ English ++++++++++++++++++++++++++++++++++++++++++++
You can use a TActionList/TAction to manage with more than one shortcut,
giving your Buttons, Menuitems... more flexibility.
You can also register "extended" shortcuts, wich are not in defined in the
standard shortcut list.
+++++++++++++++++++++++ Français++++++++++++++++++++++++++++++++++++++++++++
Vous pouvez définir des raccourcis multiples pour une action, un menu, un
bouton etc...
De plus, vous pouvez définir de nouveaux raccourcis (non définis par défaut
dans les fichiers de Delphi)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}

uses Menus;

procedure TMyForm.AddShortcut(Action: TAction; strShortcut: string;
Key: Word; Shift: TShiftState);
begin
if
Assigned(Action) then with Action.SecondaryShortCuts do
AddObject(strShortcut, TObject(Menus.ShortCut(Key, Shift)));
end;


procedure TMyForm.FormCreate(Sender: TObject);
begin
// you may define the shortcut string at will.
// for some keys on your keyboard, you'll have to look for
// the "real" keycode (use f.e FormKeyDown to retrieve
// the value :)
// Some keys are defined in the Windows unit. Look for "VK_xxxxx".
AddShortcut(MyAction1, 'CTRL+Numpad1', VK_Numpad1, [ssCTRL]);
AddShortcut(MyAction1, 'CTRL+SHIFT++', 187, [ssCTRL, ssSHIFT]);
end;


 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners