Oleg,
I attach with this message a small sample to track Mouseleave events on
Panels.
> It would be great if you could provide TStdControl with predefined events
> OnMouseEnter and OnMouseLeave in the next revisions.
> I think these events are quite useful.
We did not do it since we believe it will have a important impact in
performance.
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Oleg" <
info@cluster.samara.ru> escribió en el mensaje
news:[email=
45068d75@news.xailer.com...]
45068d75@news.xailer.com...[/email]
> Ignacio,
>
>> In Xailer you can trap any Windows message just creating a method with
>> the
>> same name of the message without the 'WM_' prefix. That's all.
>>
>> Be aware that if you return NIL from that method is like calling
>> DefWindowProc(), a zero stops the message and any other value depends on
> the
>> kind of message.
>>
>> If the message is already treated by Xailer you should consider to
>> promote
>> the message to its ancestors with:
>>
>> RETURN Super:MouseLeave( ....)
>>
>> All the WM_ messages receives the following parameters: wParam, lParam,
> hWnd
>>
>> In Xailer you can even trapWM_USER messages with the method
>> HandleEvent(),
>> onces defined on any class, all the messages not processed with WM_
> methods
>> are routed to that method.
>
> Thank you for information on Xailer's internals.
>
> Maybe all these ways work, but not in my case.
> I think that it is so because WM_MOUSELEAVE message is routed to Panel
> control, but I catch it in Form method.
> I can create MouseLeave method for a form only, but I cannot create it for
> a
> Panel control.
>
> I was able to catch WM_MOUSELEAVE message with such code (fragment).
> But this code is unusable if I need to do the same with several controls.
>
> METHOD Panel1MouseMove( oSender, nKeyFlags, nPosX, nPosY ) CLASS TForm1
> if empty(oSender:Cargo)
> oSender:Cargo:=.t.
> ::Panel1Enter()
> INITPANELPROC(oSender:Handle) // Reassign Panel WndProc
> TrackMouseEvent(oSender:Handle, TME_LEAVE, HOVER_DEFAULT)
> endif
> RETURN Nil
>
> METHOD MouseLeave( oSender ) CLASS TForm1
> if !oSender:lFocused
> ::Panel1Exit()
> endif
> oSender:Cargo:=NIL
> RETURN 0
>
> func MouseLeaveProc( oCtl )
> oCtl:oForm:MouseLeave(oCtl)
> RETURN Nil
>
> #pragma BEGINDUMP
>
> static WNDPROC wpOrigPanelProc = 0;
>
> LRESULT APIENTRY PanelCtrlProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM
> lParam)
> {
> PHB_DYNS pSymTest;
>
> if(msg == WM_MOUSELEAVE){
> if( ( pSymTest = hb_dynsymFind( "MOUSELEAVEPROC" ) ) != NULL )
> {
> hb_vmPushSymbol( pSymTest->pSymbol );
> hb_vmPushNil();
> hb_vmPush(GetControlFromHandle(hWnd));
> hb_vmDo( 1 );
>
> return 0;
> }
> else
> return 0;
> }
> else
> return CallWindowProc(wpOrigPanelProc, hWnd, msg, wParam, lParam );
> }
>
> XA_FUNC( INITPANELPROC )
> {
> WNDPROC wpPanelProc;
>
> wpPanelProc = (WNDPROC) SetWindowLong( (HWND) hb_parnl(1),
> GWL_WNDPROC, (LONG) PanelCtrlProc);
> if(!wpOrigPanelProc){
> wpOrigPanelProc = wpPanelProc;
> }
> }
>
> #pragma ENDDUMP
>
>
> It would be great if you could provide TStdControl with predefined events
> OnMouseEnter and OnMouseLeave in the next revisions.
> I think these events are quite useful.
>
> Regards,
> Oleg
>
>
>
>
Attached files test.zip (2.1 KB)Â