Posts Tagged ‘Open Tools API’

Tool Palette OpenTools API sample available – MenuPalette

Back in 2007 I wrote an OpenTools add-in for Delphi and C++Builder called MenuPalette. It allowed you to search through all the IDE menu items inside the Tool Palette. You can read the post I made at the time for more details.

In a later version of Delphi, IDE Insight took this same idea much further, so I never bothered updating MenuPalette, although it’s still available for people on older versions. However, recently I’ve had a couple of people ask about the source code. I finally dug it out last night and published it on github, as I thought it might be a useful example of interfacing with the Tool Palette via the OpenTools API. I also updated it to work with the latest version of Delphi, as one of the questions was specifically about doing this in XE2.

Hope it’s useful.

MenuPalette add-in for Delphi 2007 and C++Builder 2007

Over recent years I’ve become completely addicted to the filter function on the Tool Palette in Delphi and C++Builder. Whether I’m typing in code or in the form designer, Ctrl-Alt-P takes me to the Tool Palette and then I can just start typing to narrow down the component or Gallery Wizard I want to invoke. Create a new Unit? No problem. Ctrl-Alt-P, start typing U, n, then hit enter. Add a button to a form? Same thing, Ctrl-Alt-P, B, u, t, cursor key down a bit, hit enter, all good. Fingers don’t leave the keyboard.

Well, I was sitting in the lounge in Seoul Airport the other week, doing some coding until my flight boarded (the majority of my coding these days is done in airports or airplanes. So much for ergonomics) and I was hunting in vain through the menu items in Delphi, looking for a particular menu item. Can’t remember which one it was, but it was driving me mad trying to find it. I could remember what it was called, but couldn’t find the bloody thing.

Eventually I found it, but I was left wondering why I couldn’t filter the menu items like I could with the Tool palette. Later on the flight, I was nosing around in the Open Tools API and decided to try extending the Tool Palette to include menu items. A bit of muckign about later and MenuPalette was born (yes, I know I have a way with names).

The picture above shows it in action. It drives off the IDE’s main ActionList, and adds a Menu Items group in the Tool palette. Disabled or invisible actions will be invisible in the Tool Palette, it paints the action’s glyph correctly and in the case of menu items with the same name (eg. Options) the tool tip displays correctly to let you tell the difference. I still have to create a quick installer, but I’ll upload it to CodeCentral shortly.

Maybe it will only be of use to old buggers like me who can’t remember where the menu items are, but I suspect there are probably a few of us out there.