1

I am trying to add some functionality to Delphi's IDE to easy myself. I have found how to add menu items to the IDE main menu using INTAServices.MainMenu, also was able to create some custom component editors, so I can have my own menu items in the component's context menu. But I want to add some functionality in the context menu of the source editor. I want to select some text in the source editor and right click on it, so I can transform it the way I need, using IOTAEditorServices.TopView.buffer.EditBlock.text and IOTAEditorServices.TopView.Buffer.EditPosition.InsertText(newText); Is this possible? Or easiest way is to use a shortcut to a main menu item?

Thanks.

Kiril Hadjiev
  • 302
  • 2
  • 13
  • I'd probably look at the sources of gexperts and cnpack for ideas – David Heffernan Dec 18 '14 at 13:34
  • yes, cnpack does add menu there, but it will take me days to find out how. Thanks though. – Kiril Hadjiev Dec 18 '14 at 14:20
  • 1
    Days? 30 minutes tops. – David Heffernan Dec 18 '14 at 14:26
  • 1
    You can search information about Open Tools API (OTA). This is how you can extend the capabilities of Delphi IDE (including menus). GExperts is a sample of how extend the IDE. Old versions are avaible including source code. See it and understand how they work. – Germán Estévez -Neftalí- Dec 18 '14 at 14:28
  • Why do you people write comments like "google it" or "search information about it"? Do you believe I did not?? If you don't know the answer, just DONT ANSWER. OTA is "very good" described, just like most things in Delphi. GExperts do not add menus to the source editor context menu, or at least I did not find them. CNPack is a huge project for my understandings and too complicated to just look at it and understand the whole picture. I bet 10 bucks David could not find the 2 lines of code I am asking for in 30 min. – Kiril Hadjiev Dec 19 '14 at 06:22
  • and 30 min just passed... – Kiril Hadjiev Dec 19 '14 at 06:53
  • Put the 10 bucks into escrow first. Well, only joking. – David Heffernan Dec 19 '14 at 18:06
  • Regarding GEperts: It does not (as of 2018-11-18, but that may change shortly) add any entries to the editor popup menu. So it's pointless to search there. Also, the full source code of the current version is available, not just of old versions. – dummzeuch Nov 18 '18 at 16:10

1 Answers1

1

actually it was a single line of code: myPopup := TPopupMenu(editorServices.TopView.GetEditWindow.Form.FindComponent('EditorLocalMenu'));

Kiril Hadjiev
  • 302
  • 2
  • 13
  • I'd got as far as INTAEditWindow.Form but didn't know where to go next. How did you find the name of the component? Iterate over components and putting their names to a log? And `as` cast would be better. – David Heffernan Dec 19 '14 at 18:08
  • after a lot of searching I found this: [link](http://cc.embarcadero.com/Item/17217), and also this: [link](http://www.gexperts.org/open-tools-api-faq/#editorcontext) PS: Merry Christmas and Happy New Year etc. :) – Kiril Hadjiev Jan 05 '15 at 12:37