• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 423
  • Last Modified:

Using toolbutton's shortcuts

I have a ToolBar with ToolButtons associated with a menu on a first form.
Calling that menu items creates new forms:

 Form2 := TForm2.Create(Self);

Everything works great when I click the toolbutton using the mouse. But when
I use shortcut keys the keyboard on the new form seems not to work at all,
namely DBControls behave like disabled, although shortcut keys on buttons
work properly.
1 Solution
can you provide a touch more info perhaps as I do not fully understand the situation here
If you use the mouse, second form works correctly.
If you use the keyboard, second form does not work correctly.
Is this what you are saying?
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

shrlduAuthor Commented:
I have a menu and all menu item's OnClick events create new forms. I have a ToolBar also. The ToolButtons on it are connected to menu items. Menu items have shortcuts. Newly created forms have DBControls on them like grids, and also buttons with shortcuts etc.
When I start new forms with the mouse, the new forms work correctly. When I start the new forms with the ToolButton shortcuts I cannot for instance move the pointer in the grid or edit a DBEdit control using the keyboard - but I can use the mouse. And I can push the buttons on the new forms - with the mouse or with the shortcuts.
I use Delphi 4, Windows 98 English Edition with Polish settings (Polish programmer keyboard).
shrlduAuthor Commented:
The problem should be in principle easy to reproduce... I must add that I have changed the registry to disable the Ctrl+Alt hot keys in the IDE setting the registry string:

to "1"
Thanks to it I can use right Alt to produce Polish letters.

Thank you

Just a little thought here.  Why don't you use a TActionList component and react on a specific action instead of reacting on a menu item and on a Toolbar button.

Consider the TActionList and you will see that it will save you time and maybe solve your problem (Since you can link one Action to both a Menu Item and a Toolbar Button).

Best regards,

shrlduAuthor Commented:
Hi Stefaan,

I'm going to accept your comment as answer. When I resigned from linking the ToolButton with the menu action through MenuItem property, it started to work correctly. The ActionList works OK, and calling the action directly through ToolButton OnClick event also.

Thank you
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now