METHOD Dispatch(oEvent) CLASS <Your Flipper OLE Control Class>
LOCAL msg := oEvent:Message as DWORD
LOCAL hwndChild as ptr
do case
case msg == WM_SETCURSOR
? "WM_SETCURSOR"
case msg == WM_MOUSEACTIVATE
? "WM_MOUSEACTIVATE"
hwndChild := GetWindow(hwnd, GW_CHILD)
IF (hwndChild != null_ptr)
SetFocus(hwndChild)
ENDIF
otherwise
? msg
endcase
RETURN SUPER:Dispatch(oEvent)
However, it will all depend on what messages the OCX is sending to the dispatch method.
DO CASE
CASE uMsg == WM_SETCURSOR .AND. lParam == 33619969
SELF:Owner:symFocusedControl := #ocxCashFlowGraph
ENDCASE
RETURN SUPER:Dispatch( oEvent )
This seems to work reliably (subject to more testing though). Thanks for all your help and suggestions. I don't think I would have got there without them.
Glen,
Can I add one suggestion:
Change the start of the method to
METHOD Dispatch( uEvent ) CLASS FlipperDashboardCashFlowGraph
LOCAL oEvent := uEvent as Event
LOCAL uMsg AS LONG
and the code will perform better. That removes late binding from the method.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Glen,
If you do that then the code will be early bound and the compiler can help you find typos in your code and will produce better code.
I would recommend this in particular for methods that are executed a lot, like the Dispatch method that you were showing.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu