5

I'm attempting to create an application menu and toolbar in Delphi XE3 that looks like the following (from a program I have):

Main menu and toolbar in TCoolBar

I'm able to replicate a portion of this look by doing the following:

  1. Create a new VCL Forms application
  2. Add a TMainMenu and insert template menus for File/Edit/etc.
  3. Add a TCoolBar to the form
  4. Add a TToolBar to the TCoolBar
  5. Add a TToolButton to the TToolBar for each of File/Edit/etc. and choose the Group property
  6. Delete the Menu property from the form (so no program menu shows)
  7. Assign the MenuItem property for each TToolButton to the corresponding File/Edit/etc.
  8. Add a second TToolBar to the TCoolBar beneath the first one

Here's what it looks like:

My main menu and toolbar in TCoolBar

It's somewhat similar but is still missing all the style elements to modify the look of the new application menu.

My question is, does anyone know of how to achieve a similar look, perhaps with a third-party component library? It seems likely that the original developer used a third-party VCL library. I'd like the drop shadow in addition to the styled menus and TCoolBar.

I've tried Raize Components, TMS Advanced Toolbars & Menus, and am in the process of trying DevExpress VCL components. None of them seem to provide a solution, but perhaps I'm not familiar enough with them yet to figure it out.

spurgeon
  • 1,082
  • 11
  • 34
  • 3
    Did you try to use a `TActionMainMenuBar`? – Sertac Akyuz Feb 14 '13 at 23:37
  • 4
    +1 @Sertac. [Here](http://stackoverflow.com/questions/11963441/tmainmenu-is-not-shown-when-the-vcl-styles-is-removed-from-the-nc-area) RRUZ also recommends to use `TActionMainMenuBar` instead of `TMainMenu`, and I would trust anything this guy says about VCL styles. – kobik Feb 14 '13 at 23:53
  • 2
    @kobik - Interesting usage in the question you linked... Indeed, styles might be owing him whatever grace it is receiving from developers (not sure if this is English, meant as a compliment :)). – Sertac Akyuz Feb 15 '13 at 00:02
  • 1
    Will XP never die? ;-) – David Heffernan Feb 15 '13 at 07:43
  • 1
    @David - Not before metro dies, I hope... – Sertac Akyuz Feb 15 '13 at 14:21
  • @SertacAkyuz Hmm. I'd love to stop supporting XP. Could throw away some gnarly old bits of code. Like dialog templates for extending file dialogs. – David Heffernan Feb 15 '13 at 14:22
  • @David Not as long as a new Windows developer like myself comes along and notices that the XP styles look better than other/newer default styles. – spurgeon Feb 15 '13 at 15:26
  • @spurgeon No they don't. Well, neither of us is right. We just have different opinions. I trust you will let your users have the option of using platform default. – David Heffernan Feb 15 '13 at 15:29

1 Answers1

5

Delphi has come with an ActionBands demo that can show you how to obtain this appearance "out of the box" for your menus using TActionMainMenuBar (and TActionToolBar). Just change the Style menu to XP Style in the demo:

ActionBands demo

The rest of your steps seem pretty well complete. For the images on the menu items and toolbar buttons, see the use of ImageList components in association with the TActions on the menu and toolbar in the demo.

Ken White
  • 123,280
  • 14
  • 225
  • 444
  • Thanks, this is just what I needed. One issue though--my sample app doesn't show a drop shadow on the menu like yours does, even if I select "Menu Shadows" from the list after compiling and running. The `TActionMainMenuBar` already has the Shadows property set by default too. – spurgeon Feb 15 '13 at 01:18
  • That *is* strange. I took the screen capture from a running instance of that app (Win7 64, run from the XE3 IDE, newly built). What OS are you running on? – Ken White Feb 15 '13 at 01:27
  • Even more interesting, from the `Vcl.ActnMenus.TActionMainMenuBar.Shadows` docs: "The user can disable shadows through the OS, in which case the Shadows setting is ignored." In my other Windows 7 virtual machine, it shows shadows. So, somehow in my development virtual machine, I have shadows turned off. As to where that property is stored by the OS, I have no idea. – spurgeon Feb 15 '13 at 01:30
  • 1
    [How to turn shadows on](http://techblog.ginktage.com/2011/07/how-to-enable-or-disable-shadows-in-windows-7/): Right click My Computer -> Properties -> Advanced system settings -> Advanced -> Visual Effects -> "Show shadows under windows." Interestingly, my "Show shadows under windows" option was already checked, but I unchecked and rechecked it again and hit OK. Then the menu shadows showed up in the WordPad sample app. Weird. – spurgeon Feb 15 '13 at 01:37
  • Ah, your search fu is better than mine. :-) Thanks for the update; I was looking for it as well. I started at the Desktop->Personalization, and waded through a bunch of stuff in Control Panel, but hadn't made it to My Computer yet. – Ken White Feb 15 '13 at 01:43