Board index » delphi » Main menu in a control bar

Main menu in a control bar

I've figured out how to get a main menu in a control bar (as in Delphi 5,
Word, etc.), but now hot keys (e.g. Ctrl-S for File|Save) don't work.  What
am I doing wrong?

I found this question asked a few time in this forum by looking at Deja
News, but couldn't find an answer, other than recommendations for third
party libraries.  I don't want to buy a third party library just for this.

Thanks!

Bob Runyan

 

Re:Main menu in a control bar


When I want to assign shortcut keys to buttons I put an extra heading
on my main menu called shortcuts and set its visible property to
false. I then make a submenu item to trigger each button keypress
event and assign the appropriate shortcut key. What you get is an
invisible menu which intercepts the shortcuts. It works like a charm.

I tried to think of a way of using this principle to get round your
problem. I came up with a simple idea you could try. I cannot try it
myself since I don't have access to a main menu on a control bar.

Copy your main menu and paste it to your form. Hopefully your original
main menu will still be visible on your control bar and a second
identical menu will appear at the top of your form. If these happen go
into edit for the second main menu and select each of the top visible
menu items in turn and change its visible property to false. This
should make the second menu disappear. Now if my idea works you will
be able to access your main menu on the control bar as normal.
Shortcut keys should now access the invisible menu and work correctly.

Please let me know if it works.

Regards
John Collins

Bob and Kathy Runyan <run...@ix.netcom.com> wrote in message
news:82hlkv$d0k$1@nntp5.atl.mindspring.net...

Quote
> I've figured out how to get a main menu in a control bar (as in
Delphi 5,
> Word, etc.), but now hot keys (e.g. Ctrl-S for File|Save) don't
work.  What
> am I doing wrong?

> I found this question asked a few time in this forum by looking at
Deja
> News, but couldn't find an answer, other than recommendations for
third
> party libraries.  I don't want to buy a third party library just for
this.

> Thanks!

> Bob Runyan

Re:Main menu in a control bar


Use an actionlist. There you can define and organize all Menuitems with
shotcuts. When you create the actual menu you dont have to redefine all
Items simply set the action-property and you're finished. To use an
actionlist has also the advantage that you can use the actions for
Toolbuttons, too.

Konstantin

Quote
> I found this question asked a few time in this forum by looking at Deja
> News, but couldn't find an answer, other than recommendations for third
> party libraries.  I don't want to buy a third party library just for this.

Other Threads