Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shortcut key on button not working, though button gets focus?

Status
Not open for further replies.

carlgomerski

Programmer
Jan 20, 2001
17
0
0
AU
Hi,

Having trouble with a short cut key on a command button. Have setup a shortcut in the caption of the button "&Restore". However when I press the Alt-R shortcut the button gets focus (I can see the text being highlighted) but the click event isn't activated? I've also noticed that although the button is highlighted the "Enter" key doesn't fire the click event? When I click the button with my mouse it works fine.

The button is within a videosoft tab/elastic control and the focus is on a videosoft flexgrid when I attempt the Alt-A key press? Originally one of the tabs had the same shortcut key which I changed which then hightlighted this problem.

Any help would be appreciated

Thanks
 
Did you put the code for the button in the click event of the button or in the mousedown / mouseup event.
I could only simulate this when I did not put the code in the click event.
Using the shortcut the clickevent is triggered.
 
There could be 2 controls with the same shortcut. You should check this.
 
The code for the button is in the click event, I've put breaks in this code to see if any part of this event gets triggered, it doesn't.

I've been looking for other controls with the same shortcut keys. There are other buttons with the same shortcut but they are in different tabs on the tab control (not visible). When I press the Alt-R the button's focus goes on/off making me think there is another control that's it's jumping too but I can't find it. This is a fairly large usercontrol I'm working on but I've gone through every single control on it and can't find a duplicate (except those buttons that aren't visible on the form, they're behind other tabs).

It's a bit of an odd one this (got my co-workers stumped too). All other shortcuts on buttons on this usercontrol have the same problem too. I'm also working on another usercontrol that's similar in it's setup and it is not experiencing this problem?

Anyway, will keep on investigating...thanks for your help
 
Figured out cause of problem, it's a bit obscure and I was lucky to stumble across it.

It was caused by an issue with the Videosoft Tab control, one of the tabs didn't have an elastic/container control within it (it had a usercontrol ocx in it). Have added the elastic control (and placed the ocx on it) then the shortcuts began working...go figure...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top