Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1

TOPIC:

Flipper Graph 11 Sep 2019 08:38 #10674

  • GlenT
  • GlenT's Avatar
  • Topic Author


  • Posts: 31
  • Hi,
    I am using FlipperGraph in my VO application and I need/want to know when the FlipperGraph control has focus. I've tried FocusChange and ControlFocusChange but to no avail. Anyone got any ideas?

    Cheers

    Glen Townsley

    Please Log in or Create an account to join the conversation.

    Flipper Graph 11 Sep 2019 23:11 #10683

    • Jamal
    • Jamal's Avatar


  • Posts: 309
  • Hi Glen,

    Does the ActiveX control have an event that you may hook into?

    The FocusChange and ControlFocusChange only work with native VO controls and would not handle ActiveX controls.

    BTW, just noticed the Flipper Graph control is discontinued.

    Please Log in or Create an account to join the conversation.

    Flipper Graph 12 Sep 2019 00:18 #10684

    • GlenT
    • GlenT's Avatar
    • Topic Author


  • Posts: 31
  • Hi Jamal,

    It doesn't surprise me that it is discontinued. Its in a legacy application that I need to support for a few more years until we can get the rewrite done.

    The ActiveX doesn't seem to have anything methods I could use. I think I'll have to use MouseClick in the DataWindow to try and simulate focus. I suspect that it in not actually getting focus which is where my problem lies.

    Cheers

    Glen

    Please Log in or Create an account to join the conversation.

    Flipper Graph 12 Sep 2019 05:13 #10685

    • Jamal
    • Jamal's Avatar


  • Posts: 309
  • I am not sure how you are placing the activex control on the window.

    Have you tried?
    self:oDCYourActiveControl:SetFocus()     // change accordingly
      
    ?  self:oDCCurrentControl:Name
    
    to see if it gets focus.

    Jamal

    Please Log in or Create an account to join the conversation.

    Flipper Graph 12 Sep 2019 06:24 #10686

    • GlenT
    • GlenT's Avatar
    • Topic Author


  • Posts: 31
  • Jamal,

    I dropping an OLE object onto the window designer and then inheriting from FlipperGraph.

    I have now worked out that I can give the graph focus by setting the TabStop property to true and tabbing through the controls. The issue therefore seems to be that the ocx is trapping the mouseclick so VO doesn't see it at all.

    I've discovered an event hat may give me what I want but if it is firing, I can seem to receive it. The help for the event is attached.

    I've constructed a method in the specific DashBoardWin class:

    METHOD ocxCashflowGraph_FoundObject( oGrf, uID, nID, oObf, nBtn ) CLASS DashboardWin

    SELF:symFocusedControl := #ocxCashFlowGraph
    AltD()

    RETURN NIL

    where ocxCashFlowGraph is the ole object and self:symFocusedControl is the variable I want to set but it doesn't seem to get called so I assume I am not constructing it correctly.

    Cheers

    Glen
    Attachments:

    Please Log in or Create an account to join the conversation.

    Flipper Graph 12 Sep 2019 08:27 #10687

    • Meinhard
    • Meinhard's Avatar


  • Posts: 80
  • Hi Glen,

    please try to add a

    METHOD __OCXDefEventCallback( pszEventProtoType, ptrControlHandle) CLASS <YourWindowClass>

    and see if you get any calls here. This method is called by default if the OCX fires an event.

    Regards
    Meinhard

    Please Log in or Create an account to join the conversation.

    Flipper Graph 12 Sep 2019 19:16 #10694

    • Jamal
    • Jamal's Avatar


  • Posts: 309
  • Hi Meinhard,

    I think that should help. I tested it on an activex control and I got all kinds of events.

    Glen, look at this. You may want to test for cEventName
    METHOD __OCXDEFEVENTCALLBACK( pszEventProtoType, ptrControlHandle)  CLASS  <YourWindowClass>
    
            LOCAL cEventProtoType as STRING
            LOCAL cEventName as STRING
            
            cEventProtoType := Psz2String(pszEventProtoType) 
            cEventName := SubStr(cEventProtoType,1, At("(", cEventProtoType) -1 ) 
            // ? cEventName, cEventProtoType  
            
            // for example:
            if cEventName == "DblClick" 
            	  self:DoSomething()
            endif
          
    RETURN self      

    Please Log in or Create an account to join the conversation.

    Last edit: by Jamal.

    Flipper Graph 13 Sep 2019 00:35 #10696

    • GlenT
    • GlenT's Avatar
    • Topic Author


  • Posts: 31
  • Thanks Jamal and Meinhard,

    I've added the method

    METHOD __OCXDEFEVENTCALLBACK( pszEventProtoType, ptrControlHandle ) CLASS DashboardWin
    LOCAL cEventProtoType AS STRING
    LOCAL cEventName AS STRING

    cEventProtoType := Psz2String( pszEventProtoType )
    cEventName := SubStr3( cEventProtoType,1, At( "(", cEventProtoType ) -1 )
    // ? cEventName, cEventProtoType
    AltD()
    // for example:
    // IF cEventName == "DblClick"
    // SELF:DoSomething()
    // ENDIF

    RETURN SELF

    but it does not get called. I am thinking that the method I selected in FlipperGraph itn't doing what I had hoped.

    Thanks

    Please Log in or Create an account to join the conversation.

    Flipper Graph 13 Sep 2019 01:38 #10698

    • GlenT
    • GlenT's Avatar
    • Topic Author


  • Posts: 31
  • Jamal and Meinhard,

    I've tries a different approach and I can see that the Dispatch of the window that owns the FipperGraph control receives a message when I left mouse click in the graph control.

    The event:Message is 32 which I think is a WM_SETCURSOR but I don't understand what the wParam and lParam are.

    Cheers

    Glen

    Please Log in or Create an account to join the conversation.

    Flipper Graph 13 Sep 2019 18:31 #10709

    • Jamal
    • Jamal's Avatar


  • Posts: 309
  • Glen,

    In your PostInit(), are you using ?

    self:ODCocxCashFlowGraph :CreateEmbedding("Your Control Prog ID", "Your License Key")

    If the OCX is a "normal" control, the __OCXDEFEVENTCALLBACK should work, otherwise, I am running out of ideas.

    Jamal

    Please Log in or Create an account to join the conversation.

    Last edit: by Jamal.

    Flipper Graph 13 Sep 2019 19:18 #10711

    • Jamal
    • Jamal's Avatar


  • Posts: 309
  • I don't think the wparam or lparam help here, I've only used them to trap function keys and character input.

    May be you need to look for WM_MOUSEACTIVATE message:
    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.

    Edit: reference for messages list: wiki.winehq.org/List_Of_Windows_Messages

    Please Log in or Create an account to join the conversation.

    Last edit: by Jamal.

    Flipper Graph 14 Sep 2019 06:49 #10715

    • GlenT
    • GlenT's Avatar
    • Topic Author


  • Posts: 31
  • Jamal and Meinhard,

    I think I have a working solution. I subclassed the Flipper Control and added a Dispatch to the subclass:

    METHOD Dispatch( oEvent ) CLASS FlipperDashboardCashFlowGraph
    LOCAL uMsg AS LONG
    LOCAL wParam AS DWORD
    LOCAL lParam AS LONG

    uMsg := oEvent:Message
    wParam := oEvent:wParam
    lParam := oEvent:lParam

    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.

    Cheers

    Glen

    Please Log in or Create an account to join the conversation.

    Flipper Graph 14 Sep 2019 11:41 #10717

    • robert
    • robert's Avatar


  • Posts: 3595
  • 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

    Please Log in or Create an account to join the conversation.

    Flipper Graph 14 Sep 2019 21:52 #10723

    • GlenT
    • GlenT's Avatar
    • Topic Author


  • Posts: 31
  • Thank you Robert. I've made that change.

    Cheers

    Glen

    Please Log in or Create an account to join the conversation.

    Flipper Graph 14 Sep 2019 22:21 #10724

    • GlenT
    • GlenT's Avatar
    • Topic Author


  • Posts: 31
  • Robert,

    As an after thought, would you recommend that I make the same change to the various Data, Dialog and DataDialog windows I have in the application?

    Cheers

    Glen

    Please Log in or Create an account to join the conversation.

    Flipper Graph 15 Sep 2019 14:56 #10727

    • robert
    • robert's Avatar


  • Posts: 3595
  • 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

    Please Log in or Create an account to join the conversation.

    Flipper Graph 15 Sep 2019 20:05 #10730

    • GlenT
    • GlenT's Avatar
    • Topic Author


  • Posts: 31
  • Thanks Robert

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1