I have created a toolbar using custom toolbar control on VB6 Form.When user
clicks a tool button, a second Form pops up just below the button (like a
dropdown menu). And when user moves (not click) the mouse on the next button
of the toolbar, the first menu disappears and the second menu (another Form)
pops up. While the mouse is still over the second button (not clicked), the
user moves the mouse to the title bar of the Main form (that is right above
the toolbar) with an intention of moving the Main form. When the Main form
moves, the second popup menu (a Form) still remains open.
How can I make the second menu to disappear when the user clicks on the
title bar of the Main From? I have tried the following:
Set the Visible property of the second form to False in the GotFocus event
of the Main Form. But it did not work. It seems the clicking on the title bar
of a form does not get a focus to the form. I did the same in the MouseMove
event of the Toolbar. This also did not work.
Note that the toolbar does not have LostFocus event. I cannot use the
MouseUp event of the Toolbar since the mouse is not clicked on the second
button of the toolbar, it is just hovered over the second button.
I can do the following but want to avoid doing these two techniques:
1. Place a second control (e.g, a label) in between the toolbar and the
title bar of the Main form and use the MouseMove event of that second
control: This will make the toolbar look a little ugly
2. Get rid of the title bar of the Main Form using Windows API and create my
own custom title bar: Using APIâ??s can sometime cause some other issues
depending on the userâ??s system.
>
> Set the Visible property of the second form to False in the GotFocus event
> of the Main Form. But it did not work. It seems the clicking on the title
> bar
> of a form does not get a focus to the form. I did the same in the
> MouseMove
> event of the Toolbar. This also did not work.
Try the Activate event. Gotfocus will not fire on a form if it contains
controls that can rec'v focus.