2

I am working on an editor in which multiple windows can be created and used when either docked or floating. The difficulty is that clicking the main form's TMenu takes focus from a floating window if the floating window is focused. A question very similar to this one was discussed about 1 year ago: How do I prevent menu and toolbar clicks stealing focus from a floating form? However, the only answer to that question worked around the problem by using TActionMainMenuBar and TActionToolbar. So the question remains -- how can I prevent TMainMenu from taking focus from a floating window?

Community
  • 1
  • 1
TomT
  • 199
  • 1
  • 1
  • 11
  • You can't when using `TMainMenu`. It is a standrd Windows menu, on another form. That form has to gain input focus before its menu can be invoked by the user. `TActionMainMenuBar` and `TActionToolbar` can get around that because they are not standard Windows menus, they display their own popup windows, and thus have more control over focus. – Remy Lebeau Jun 13 '15 at 16:28

1 Answers1

0

The answer is to use MDI and TMainMenu.

Have the Child MDI forms merge their menus with the Mainform. Then the focus stays with the MDI child.

When the menu is clicked, the focus is on the menu, but as soon as the menu is hidden, focus returns to the original form.

Rohit Gupta
  • 4,022
  • 20
  • 31
  • 41