Ctrl+空格,和输入法快捷键有冲突。要先禁输入法的快捷键才可用。
也可以修改为 Alt + 空格,将以下代码保存为 pasKeyboard.pas,新建一个 Package,
加入这个pas文件安装就可以了。
unit pasKeyboard;
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 = 'Szy''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(VK_SPACE, [ssAlt])], CodeCompletion, Pointer(csCodeList 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 := 'Szy.BufferList';
end;
end.