fbpx
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

Flipper Graph 1 week 2 hours ago #10674

  GlenT's Avatar Topic Author GlenT Offline Posts: 9
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 6 days 12 hours ago #10683

  Jamal's Avatar Jamal Offline Posts: 137
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 6 days 10 hours ago #10684

  GlenT's Avatar Topic Author GlenT Offline Posts: 9
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 6 days 6 hours ago #10685

  Jamal's Avatar Jamal Offline Posts: 137
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 6 days 4 hours ago #10686

  GlenT's Avatar Topic Author GlenT Offline Posts: 9
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 6 days 2 hours ago #10687

  Meinhard's Avatar Meinhard Offline Posts: 41
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 5 days 15 hours ago #10694

  Jamal's Avatar Jamal Offline Posts: 137
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 5 days 10 hours ago #10696

  GlenT's Avatar Topic Author GlenT Offline Posts: 9
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 5 days 9 hours ago #10698

  GlenT's Avatar Topic Author GlenT Offline Posts: 9
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 4 days 16 hours ago #10709

  Jamal's Avatar Jamal Offline Posts: 137
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 4 days 15 hours ago #10711

  Jamal's Avatar Jamal Offline Posts: 137
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 4 days 4 hours ago #10715

  GlenT's Avatar Topic Author GlenT Offline Posts: 9
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 3 days 23 hours ago #10717

  robert's Avatar robert Offline Posts: 1158
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 3 days 13 hours ago #10723

  GlenT's Avatar Topic Author GlenT Offline Posts: 9
Thank you Robert. I've made that change.

Cheers

Glen

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

Flipper Graph 3 days 12 hours ago #10724

  GlenT's Avatar Topic Author GlenT Offline Posts: 9
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 2 days 20 hours ago #10727

  robert's Avatar robert Offline Posts: 1158
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 2 days 15 hours ago #10730

  GlenT's Avatar Topic Author GlenT Offline Posts: 9
Thanks Robert

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

  • Page:
  • 1