How to Prevent TMainMenu from Taking Focus from Floating Window

195 views Asked by At

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?

1

There are 1 answers

1
Rohit Gupta On

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.