Recent

Author Topic: IDE Coolbar units  (Read 1051 times)

staratel20

  • Full Member
  • ***
  • Posts: 228
IDE Coolbar units
« on: March 24, 2026, 03:24:41 pm »
Hello everyone

I'm trying to create a useful extension for Lazarus that should integrates into the Coolbar IDE as an additional button. Could you suggest some module names that would help me better understand how the "Desktops" button works? The extension itself is very similar to "Desktops," so I'd like to use the base module as a basis and replace the handlers.

Thanks in advance!
« Last Edit: March 24, 2026, 03:46:18 pm by staratel20 »
Windows 11 , FPC 3.2.2, Lazarus v4.4

CountIdentity, ModeClassName - good property naming
IdentityCount,  ClassNameMode  - bad property naming

staratel20

  • Full Member
  • ***
  • Posts: 228
Re: IDE Coolbar units
« Reply #1 on: March 24, 2026, 08:07:06 pm »
The example that adds a simple button to the IDE Coolbar next to the “Desktops” button (or anywhere else) would also be very helpful. For example, when the user presses the button, the result is “Hello, world!” message.
Windows 11 , FPC 3.2.2, Lazarus v4.4

CountIdentity, ModeClassName - good property naming
IdentityCount,  ClassNameMode  - bad property naming

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12336
  • Debugger - SynEdit - and more
    • wiki
Re: IDE Coolbar units
« Reply #2 on: March 24, 2026, 08:39:02 pm »
Afaik there isn't much frequent work on that code, so probably few (if any) will know from the top of their head.... Meaning, everyone else has to search stuff too.
The most recent I recall (but there may be more recent) was adding the config... But not sure when/who. Best suggestion: search the git log.

I certainly haven't done any work on the coolbar code...
But, the config appears to list all the entries from the menus. Maybe also all available key commands.
So adding to those would be a first step. No idea how to add any of those as default to the coolbar.

As for adding a menu, and key command. I have done just that recently: https://gitlab.com/freepascal.org/lazarus/lazarus/-/commit/e649b2157af99c9abb23599a4c7acfeb6545f57c
Ignore the bits in fpdebug. The remainder shows where to add a new command.

Well, you can actually do that from a package too. git blame on the ide interface unit, should help you find a commit that does it.


staratel20

  • Full Member
  • ***
  • Posts: 228
Re: IDE Coolbar units
« Reply #3 on: March 24, 2026, 09:04:05 pm »
Thanks, Martin!

That definitely narrows down the scope of my search quite a bit.
I just want to clarify one thing. You mentioned: “git blame on the IDE interface unit should help you find a commit that does it.” As I understand it, “git blame” is a command that might point me in the right direction. However, I’m not entirely sure which IDE interface unit you’re referring to, and I assume I need to run it on that specific file to find the relevant commit.

Could you please clarify which unit I should look at, or is it one of those that almost no one remembers the name of?
Windows 11 , FPC 3.2.2, Lazarus v4.4

CountIdentity, ModeClassName - good property naming
IdentityCount,  ClassNameMode  - bad property naming

staratel20

  • Full Member
  • ***
  • Posts: 228
Re: IDE Coolbar units
« Reply #4 on: March 24, 2026, 09:16:12 pm »
Also, I thought that registering a command is fairly standardized and straightforward, considering that almost any extension needs to add a command. Of course, this doesn’t create a button on a panel automatically, but it’s a good start — the user can add a button manually.

Registering a component to the main menu might also be an option, so any examples would be greatly appreciated
Windows 11 , FPC 3.2.2, Lazarus v4.4

CountIdentity, ModeClassName - good property naming
IdentityCount,  ClassNameMode  - bad property naming

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12336
  • Debugger - SynEdit - and more
    • wiki
Re: IDE Coolbar units
« Reply #5 on: March 24, 2026, 09:49:41 pm »
Sorry, actually the ide interface unit is the wrong lead.

But look at packages in the component dir that start with IDE: idescout, idelazlogger, ideinspector => they all register either a menu or key. Otherwise they wouldn't be reachable in the IDE.

They usually have a register procedure.
E.g. https://gitlab.com/freepascal.org/lazarus/lazarus/-/blob/main/components/IdeLazLogger/idelogger.pas?ref_type=heads#L125

If you look through them you should find more examples of RegisterIDEMenuCommand and probably other similar commands.

It's possible that this will also be on the wiki. I haven't looked.

staratel20

  • Full Member
  • ***
  • Posts: 228
Re: IDE Coolbar units
« Reply #6 on: March 25, 2026, 11:40:54 am »
>>But look at packages in the component dir that start with IDE: idescout, idelazlogger, ideinspector => they all register either a menu or key.

Thanks, I think that's exactly what I need to get familiar with

P/s: I’ve taken a long break from programming, and now I see huge changes in Lazarus. Thanks to everyone who contributed 8)
« Last Edit: March 25, 2026, 11:59:36 am by staratel20 »
Windows 11 , FPC 3.2.2, Lazarus v4.4

CountIdentity, ModeClassName - good property naming
IdentityCount,  ClassNameMode  - bad property naming

 

TinyPortal © 2005-2018