1

I have a .NET 3.5 Winforms project. This project has a main form with a toolbar on it with a toolbar button in it. And a simple normal button dropped directly on to the form.

When the main form starts up a smaller sub form is loaded up too in the load event of the main form with the .Show method (so it is not modal which is important). The focus is on this subform.

When I hover with the mouse over the toolbar button in the main form it responds to the mousehover event but when i click the toolbar button the main form first receives focus, so I have to click again. Only then the click event is fired. When I however do this to the normal button it immediatly responds to the click wether the sub form has focus or not.

So my question is why does this happen? And how can I prevent it so my endusers do not need to click the toolbar button twice?

Danny van der Kraan
  • 5,344
  • 6
  • 31
  • 41
  • If the mouse-hover responds, why not adding to its code the focusing of the main form? – user3165438 Oct 27 '14 at 07:53
  • How do you know the end user's intent? To be more concrete; if by accident the mouse hovers over the toolbar button and I shift focus to the main form, in my application the end user would not be able to type text in the sub form. – Danny van der Kraan Oct 27 '14 at 08:12

0 Answers0