Home page Home page Home page Home page
Pixel
Pixel Header R1 C1 Pixel
Pixel Header R2 C1 Pixel
Pixel Header R3 C1 Pixel
Pixel
By Captain C | Monday 1 March 2010 12:05 | 0 Comments
Getting notification of mouse messages has always been something of a problem with OpenInsight EditTable controls. With other controls this process is quite easy - you simply qualify the WINMSG event with the relevent mouse message number and you can easily respond to it, but with an EditTable this process fails.

This is mainly due to the architecture of the EditTable itself - it's not really a single control, it's actually two: The visible control that you interact with (known as the "DataTbl" control) and a very thin parent wrapper around it (called the "Editable" control).

When you use an EditTable control in your application OpenInsight creates the wrapper control which in turn creates the visible "DataTbl" control. When you interact with an EditTable in Basic+ you are interacting directly with the wrapper - it simply passes on your request to the "DataTbl" as appropriate. If you qualify the WINMSG event on an EditTable you are qualifying against the wrapper - you are NOT qualifying against the visible "DataTbl" control!

When the user interacts with the EditTable control they communicate with the visible "DataTbl", so it is this part that receives the mouse messages. These messages are interpreted and the relevant notifications passed up to the wrapper and then onto OpenInsight - they are not passed directly, so you will never be able use a WINMSG event with the usual mouse messages.

However, since OpenInsight 9.1 it has been possible to trap mouse messages by another means. In this version, when the "DataTbl" receives a mouse message, it actually sends a notification message to the wrapper that you can pick up with a WINMSG event. The mouse message itself is simply offset by the value 3124 (WM_USER + 2100).

For example to detect a "Right Mouse Button Down" message you would qualify against WM_RBUTTONDOWN + 3124 like so:


   $insert logical
   
   * // From the Windows SDK headers:
   equ WM_USER$                   to 0x0400
   
   equ WM_LBUTTONDOWN$            to 0x0201
   equ WM_LBUTTONUP$              to 0x0202
   equ WM_LBUTTONDBLCLK$          to 0x0203
   equ WM_RBUTTONDOWN$            to 0x0204
   equ WM_RBUTTONUP$              to 0x0205
   equ WM_RBUTTONDBLCLK$          to 0x0206
   equ WM_MBUTTONDOWN$            to 0x0207
   equ WM_MBUTTONUP$              to 0x0208
   equ WM_MBUTTONDBLCLK$          to 0x0209
   
   * // Offset value
   equ ETM_MOUSEMSGOFFSET      to (WM_USER$ + 2100) ; * // 3124
   
   * // EditTable Mouse message notifications
   equ ETM_LBUTTONDOWN$         to (ETM_MOUSEMSGOFFSET$ + WM_LBUTTONDOWN$)
   equ ETM_LBUTTONUP$           to (ETM_MOUSEMSGOFFSET$ + WM_LBUTTONUP$)
   equ ETM_LBUTTONDBLCLK$       to (ETM_MOUSEMSGOFFSET$ + WM_LBUTTONDBLCLK$)
   equ ETM_MBUTTONDOWN$         to (ETM_MOUSEMSGOFFSET$ + WM_MBUTTONDOWN$)
   equ ETM_MBUTTONUP$           to (ETM_MOUSEMSGOFFSET$ + WM_MBUTTONUP$)
   equ ETM_MBUTTONDBLCLK$       to (ETM_MOUSEMSGOFFSET$ + WM_MBUTTONDBLCLK$)
   equ ETM_RBUTTONDOWN$         to (ETM_MOUSEMSGOFFSET$ + WM_RBUTTONDOWN$)
   equ ETM_RBUTTONUP$           to (ETM_MOUSEMSGOFFSET$ + WM_RBUTTONUP$)
   equ ETM_RBUTTONDBLCLK$       to (ETM_MOUSEMSGOFFSET$ + WM_RBUTTONDBLCLK$)

   * // To trap a right button down message:
   call Send_Message( @window : ".TABLE_1", "QUALIFY_EVENT", ETM_RBUTTONDOWN$, TRUE$ )


Labels: , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home

Previous Posts
Archives
BlogRoll

Powered by Blogger

Subscribe to
Posts [Atom]

 

 

Pixel
Pixel Footer R1 C1 Pixel
Pixel
Pixel
Pixel