Link to home
Start Free TrialLog in
Avatar of Alaska Cowboy
Alaska CowboyFlag for United States of America

asked on

Can't access menu item's shortcut text for custom menu item.

I have a menu bar, everything works great.

But the Shortcut Text is not available for entry. Can I access this? It's available for standard menu items (like Help - F1), but the Shortcut Text field is grayed out for my custom menu items.

One of my items is "Top 10 Issues", with the 1 underlined for hot key. So if you press
Alt, Search Menu, then 1, it queries on the top 10 issues, works great.

Then I have a hidden button with hotkey = 1, so if the user presses Alt-1, the button kicks in, which is the same action as the menu. I just can't access the Shortcut Text field on my "Top 10 Issues" menu option.
SOLUTION
Avatar of puppydogbuddy
puppydogbuddy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Alaska Cowboy

ASKER

PDB, thanks for the tip. I forgot about the Startup Properties, but it is checked (yes) to allow changes to menus and toolbars. I'll have a look at Jamie's site.
PDB, in Jamie's tutorial, the Shortcut Text field is also grayed out . . . so maybe you can't get to it for custom menu items.

btw, I completely revised the look of my application, with a custom menu and toolbar(s) being one of the main revisions (and easy to do . . .)
Avatar of puppydogbuddy
puppydogbuddy

Bill,
You are really putting in all the bells and whistles....and I bet it has been exciting every step of the way!

Getting back to your problem at hand.  Which exhibit are you referring to in Jamie's tutorial.  If you look at Figure 15, where the shortcut menubar is selected, you should be able to look at (and change) the properties.
<Shortcut Text field is grayed out for my custom menu items>
I've not spent much time on this but I have never been able to set this on my custom menu items either.

Steve
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
PDB, Figure 9 "ShortCut Text" is grayed out.

Yes, I'm had a lot of fun fixing the app. Mostly it's been the UI and installation procedures. I picked up Inno Setup and that is fantastic. I'll be sending it back to you around the end of May for another look.
Steve,

Thanks for checking this out.

I added your code but it doesn't seem to work.

It compiles successfully but the ShortCut text doesn't show up when running the app.

I put this in my startup form:
    'To set the Shortcut Text for menu items
    Application.CommandBars("Info Manager").Controls.Item("Top &10 Items Only").Controls.Item(1).ShortcutText = "Ctrl + 1"
    Application.CommandBars("Info Manager").Controls.Item("&Show Search Fields").Controls.Item(1).ShortcutText = "Ctrl + 8"
    Application.CommandBars("Info Manager").Controls.Item("&New List").Controls.Item(1).ShortcutText = "Alt + J"

No shortcut text shows up . . .

I then put the code in the form_load event of the one form that uses this menu - Access choked on it.

Bill
I also tried it without the & (just to be sure), but still nothing shows up.

this is pretty low priority, so no need for any extensive research or testing.

Thanks.
I did not test it while the app was running, I only opened the database in design mode and ran the code from the immediate window.

Steve
Ok, don't worry about it. Thanks for checking back.
<I only opened the database  ...> but the setting was there the next time I opened the app so you only need to do this once during design.
Steve, thanks again. I'd still like to replicate what you have done, but not able to do so.

(I never use the Immediate Window, never had it explained to me)

but anyway,
- My app is running
- I copied to the immediate window: Application.CommandBars("Info Manager").Controls.Item("Top 10 Items Only").Controls.Item(1).ShortcutText = "Ctrl + 1"
, then pressed Enter.

it said "Run=time error '5': Invalid procedure call or argument.

It compiles fine and when I de-bug it, it just goes its merry way past the statement without batting an eye - but not Shortcut text :-(
not sure if this is your issue but  ... I displayed my custom menu before I executed the code.
still not working, but thanks for checking back. It's really minor so I'll just keep it on my enhancements list . . .