ToolStrip and it's responsiveness

I had a problem with the new .NET 2.0 component "ToolStrip". The problem appeared when switching between forms within an application by clicking on one of the toolstrip buttions. The first click was not "catched" as an event. This was really annoying and I was near switching to the toolstrip components of Infragistics.

First I found a quick solution. I added the event "MouseHover" and then focused on the toolstrip like this:

Private Sub tolMain_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tolMain.MouseHover
End Sub

It worked but it seemed unnesseary. I did a quick search on the Internet and I found a post from one who had faced and solved the problem. Read more about it here: http://blogs.msdn.com/rickbrew/archive/2006/01/09/511003.aspx

He hade made a C# example and here is my code, converted to VB.NET:

Imports System.Windows.Forms.ToolStrip
Public Class ToolStripEx
Inherits ToolStrip
Private bolClickThrough As Boolean = False

Public Property ClickThrough() As Boolean
Return bolClickThrough
End Get
Set(ByVal value As Boolean)
bolClickThrough = value
End Set
End Property

Public Sub New()
End Sub

Protected Overrides Sub WndProc(ByRef m As Message)
If bolClickThrough Then
If m.Msg = NativeConstants.WM_MOUSEACTIVATE And m.Result = CType(NativeConstants.MA_ACTIVATEANDEAT, IntPtr) Then
m.Result = CType(NativeConstants.MA_ACTIVATE, IntPtr)
End If
End If
End Sub
End Class

Friend Class NativeConstants
Friend Const WM_MOUSEACTIVATE As UInt32 = 33
Friend Const MA_ACTIVATE As UInt32 = 1
Friend Const MA_ACTIVATEANDEAT As UInt32 = 2
Friend Const MA_NOACTIVATE As UInt32 = 3
Friend Const MA_NOACTIVATEANDEAT As UInt32 = 4
End Class


Long time no blog

There have been a lot of work on VisualCron lately. There is a clear roadmap but sometimes I get busy on sidetracks - smaller o bigger requests by customers. Luckily, my dad, a professional tester has been there helping with testing and documentation.

On the personal side, I have a lot of things that I look forward to. First, the average temperature is increasing every day. Second, there will be a lot of traveling this year. In the end of May, me and Neda are traveling to Istanbul, Turkey. In July we will travel to Malage in Spain. Later in the autumn, me and my friends are going to London.

I haven't had the time to work with the studio yet. Hopefully there will be more time soon..