如何改变Delphi的快捷键
点击次数:37 次 发布日期:2008-11-09 08:41:49 作者:源代码网
|
源代码网推荐 源代码网推荐 下面这个例子使用IOTAKeyboardBinding接口,实现对快捷键的重新绑定,相关的接口定义见ToolsAPI.pas。源码很简单,相信你一看就懂。该例子用来修改与中文环境冲突的Code Completion得快捷键,改成Ctrl Alt Shift P和Ctrl Alt Shift O,如果你遇上什么问题,请写信给我。 源代码网推荐 源代码网推荐 //EagleBufferList.pas,2002.5.24 源代码网推荐 源代码网推荐 { 源代码网推荐 Pan Ying,Zero Studio 源代码网推荐 All Right Reserved. 源代码网推荐 源代码网推荐 The Demo show how to change Delphi"s Key Binding,just in Delphi 源代码网推荐 press Ctrl Alt Shift P to use Code Completion.You can contact me by 源代码网推荐 sending e-mail to me (panying@sina.com) 源代码网推荐 源代码网推荐 Some code from Delphi"s ToolsAPI Demo. 源代码网推荐 源代码网推荐 Attention: 源代码网推荐 This software is provided "as-is", without any express or 源代码网推荐 implied warranty. In no event will the author be held liable 源代码网推荐 for any damages arising from the use of this software. 源代码网推荐 源代码网推荐 This unit is free to use but the origin of this software 软件开发网 www.mscto.com 源代码网推荐 must not be misrepresented, you must not claim that you 源代码网推荐 wrote the original software. 源代码网推荐 源代码网推荐 Feel free to use this component in your product including 源代码网推荐 commercial applications. 源代码网推荐 源代码网推荐 If You alert this component"s code to make it better, 源代码网推荐 please remember to tell me about it , let"s to make it better 源代码网推荐 together. 源代码网推荐 源代码网推荐 This attention may not be removed or altered from any source 源代码网推荐 distribution. 源代码网推荐 源代码网推荐 Feedback: 源代码网推荐 E-Mail: panying@sina.com 源代码网推荐 HomePage:http://myzeroworld.yeah.net 源代码网推荐 源代码网推荐 Version 1.1 源代码网推荐 Remove some useless code. 源代码网推荐 Version 1.0 源代码网推荐 Initial Version. 源代码网推荐 } 源代码网推荐 源代码网推荐 unit EagleBufferList; 源代码网推荐 源代码网推荐 interface 源代码网推荐 源代码网推荐 procedure Register; 源代码网推荐 源代码网推荐 implementation 源代码网推荐 源代码网推荐 uses Windows, Classes, SysUtils,Menus, ToolsAPI, Controls ; 源代码网推荐 源代码网推荐 type 源代码网推荐 TBufferList = class(TNotifierObject, IUnknown, IOTANotifier, 源代码网推荐 IOTAKeyboardBinding) 源代码网推荐 function GetBindingType: TBindingType; 源代码网推荐 function GetDisplayName: string; 源代码网推荐 function GetName: string; 源代码网推荐 procedure BindKeyboard(const BindingServices: IOTAKeyBindingServices); 源代码网推荐 protected 源代码网推荐 procedure CodeCompletion(const Context: IOTAKeyContext; KeyCode: TShortcut; 源代码网推荐 var BindingResult: TKeyBindingResult); 源代码网推荐 end; 源代码网推荐 源代码网推荐 resourcestring 源代码网推荐 sBufferList = "Eagle""s Buffer List"; 源代码网推荐 源代码网推荐 //register this key binding 源代码网推荐 procedure Register; 源代码网推荐 begin 源代码网推荐 (BorlandIDEServices as IOTAKeyBoardServices).AddKeyboardBinding(TBufferList.Create); 源代码网推荐 end; 源代码网推荐 源代码网推荐 { TBufferList } 源代码网推荐 源代码网推荐 源代码网推荐 //the code to bind key 源代码网推荐 procedure TBufferList.BindKeyboard(const BindingServices: IOTAKeyBindingServices); 源代码网推荐 begin 源代码网推荐 BindingServices.AddKeyBinding([ShortCut(Ord("P"), [ssShift, ssCtrl, ssAlt])], CodeCompletion, Pointer(csCodeList or csManual)); 源代码网推荐 BindingServices.AddKeyBinding([ShortCut(Ord("O"), [ssShift, ssCtrl, ssAlt])], CodeCompletion, Pointer(csParamList or csManual)); 源代码网推荐 end; 源代码网推荐 源代码网推荐 //do code completion 源代码网推荐 procedure TBufferList.CodeCompletion(const Context: IOTAKeyContext; 源代码网推荐 KeyCode: TShortcut; var BindingResult: TKeyBindingResult); 源代码网推荐 begin 源代码网推荐 源代码网推荐 (Context.EditBuffer.TopView as IOTAEditActions).CodeCompletion(Byte(Context.Context)); 源代码网推荐 BindingResult := krHandled; 源代码网推荐 源代码网推荐 end; 源代码网推荐 源代码网推荐 function TBufferList.GetBindingType: TBindingType; 源代码网推荐 begin 源代码网推荐 Result := btPartial; 源代码网推荐 end; 源代码网推荐 源代码网推荐 function TBufferList.GetDisplayName: string; 源代码网推荐 begin 源代码网推荐 Result := sBufferList; 源代码网推荐 end; 源代码网推荐 源代码网推荐 function TBufferList.GetName: string; 源代码网推荐 begin 源代码网推荐 Result := "EagleKing.BufferList"; //do not localize 源代码网推荐 end; 源代码网推荐 源代码网推荐 end. 源代码网推荐 源代码网推荐 如果你对组件或者向导编写感兴趣,到CNPack( http://cnpack.yeah.net )来看看。 源代码网推荐 源代码网推荐 Pan Ying,2002.5.25 源代码网推荐 零点天地(转载请保留此链接) 源代码网推荐 源代码网供稿. |
