Forum > Editor

[Solved] How to assign a shortcut to a package?

(1/1)

loaded:
Hi All,
What should I do to call a method that I will add to a package that I will write, with shortcut keys from within the ide?
I would be very happy if you share your ideas and suggestions. Respects.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit Suas;{$mode objfpc}{$H+} interface uses  MenuIntf, SrcEditorIntf, LCLIntf,Unit_Sua,Classes, SysUtils; procedure Register; implementation procedure Todo(); // I want to call this method with hotkey. eg Alt + Enterbegin//...end;   procedure Register;begin//What code should I write for this part?end; end.

Martin_fr:
Search for "RegisterIDECommand" in the components folder. (e.g. MessageComposer uses it)

loaded:
Master martin_fr thank you very much for the reply.
I solved my problem, let's leave it here, maybe someone will need it one day. Respects.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- procedure Todo(Sender: TObject);  // I want to call this method with hotkey. eg Alt + Enterbegin//...end; procedure Register;const   CommandCategory = 'ToolMenu';var  Key: TIDEShortCut;  Ccc: TIDECommandCategory;  Commander: TIDECommand;begin  Key := IDEShortCut(VK_RETURN, [ssAlt], VK_UNKNOWN, []);  Ccc := IDECommandList.FindCategoryByName(CommandCategory);  Commander := RegisterIDECommand(Ccc, 'UnitSearchAutoAdd','Unit Search/ Auto Add', Key, nil, @Todo);end;

Navigation

[0] Message Index

Go to full version