ToolBar Click Behavior [vb.net]

NeuralJack

Centurion
Joined
Jul 28, 2005
Messages
138
I'm working with a lot of Toolbars for my buttons. There is a thing that's driving me crazy about them though. I often have the user using 2 forms.

Lets say you have Button1 on ToolBar1 which is on Form 1..
Well if you have the focus on another form , such as Form2 and you click the Button1 then you have to click the button 2x for it to register the click. The first click only chooses Form1, and does not click the button. No other control on Form1 has this problem but the Toolbar button1.

I'm not sure if this is a 2.0 thing or what, Wordpads toolbar does not seem to have this issue but VS.Net 2005's Interface Toolbar does.
 
The reason you see this behavior in .Net 2.0 is because in .Net 2.0 we generally use the ToolStrip control, the control with this problem. In .Net 1.x we used the ToolBar control, which still does not have this problem in 2.0.

I hoped that in this situation perhaps the MouseDown event could be handled, where a hit test could be performed to see which button was clicked so that we could, by calling the PerformClick method of a ToolStripItem, force the click through code. The problem, it seems, is that the ToolStrip does not recieve MouseDown or Click events when the form it's on does not have focus.
 
Ya, i suppose i'll probably not use toolstrips then. This is an unfortunate thing in 2.0

marble_eater said:
The reason you see this behavior in .Net 2.0 is because in .Net 2.0 we generally use the ToolStrip control, the control with this problem. In .Net 1.x we used the ToolBar control, which still does not have this problem in 2.0.

I hoped that in this situation perhaps the MouseDown event could be handled, where a hit test could be performed to see which button was clicked so that we could, by calling the PerformClick method of a ToolStripItem, force the click through code. The problem, it seems, is that the ToolStrip does not recieve MouseDown or Click events when the form it's on does not have focus.
 
Back
Top