Focus
-
If we drug the toolbar of the main window and click any control on a toolbar, normally focus is returned to main window after we release the mouse button (at least is how Microsoft toolbars behave) I am trying to implement a toolbar. When to return focus to main window?
-
If we drug the toolbar of the main window and click any control on a toolbar, normally focus is returned to main window after we release the mouse button (at least is how Microsoft toolbars behave) I am trying to implement a toolbar. When to return focus to main window?
A simple way to answer your own question is, what bugs you the most when you use toolbars? I would prefer to have the focus returned to the main window as soon as a control on the toolbar has been used. That way I can continue working without that extra click required to move the focus to the working area. But then again, people have different preferences. // Afterall, I realized that even my comment lines have bugs When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
-
If we drug the toolbar of the main window and click any control on a toolbar, normally focus is returned to main window after we release the mouse button (at least is how Microsoft toolbars behave) I am trying to implement a toolbar. When to return focus to main window?
I don't understand the process you describe, could you please specify? When do you click on the control, after the drop? When the toolbar is floating? Is the control something like a combobox embedded on the toolbar? WiB wrote: I am trying to implement a toolbar. Do you derivate a new class from CToolbar or directly from CWnd?
We do not inherit the Earth from our ancestors, we borrow it from our children - Antoine de Saint-Exupéry (1900-1944)
-
If we drug the toolbar of the main window and click any control on a toolbar, normally focus is returned to main window after we release the mouse button (at least is how Microsoft toolbars behave) I am trying to implement a toolbar. When to return focus to main window?
Ok. Just to be sure on the words we use, let's define some: When a toolbar is detached, we say it is "floating". When it is attached, we say it is "docked". The behaviour of a toolbar when floating is different of when docked. With the MFC, when a toolbar is floating, it is no more the direct descendant of the main window but the descendant of a new window, a docking frame. This new window is created when the toolbar is detached and is generally from the class CMiniFrameWnd. So, if you try to activate the parent, it might be not the good one. IMHO, it should be the window receiving the command sent by the toolbar button which should set the focus to itself, and not the toolbar setting the focus to the window. HTH,
We do not inherit the Earth from our ancestors, we borrow it from our children - Antoine de Saint-Exupéry (1900-1944)