Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Pass the kbd actions to hosted activex (Read 3465 times)
andrewsando1973
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Feb 14th, 2010
Pass the kbd actions to hosted activex
Feb 18th, 2010 at 10:30am
Print Post  
Sir,

I've added a flowchart control (as AxControl) to  a parent flowchart. and i adjusted the hosted flowchart with SetDocSize in order to look like a page.

i adjusted the Behavior Property of the parent to DoNothing , and the SelBoxStyle to Invisible and kbdActive to Nothing.

So now  i have 2 Questions:

1) How can i pass the kbdactions to the child flowchart so that i can delete or move boxes in that child flowchart or how to pass the kbd event to any hosted ActiveX Control in general?

2) How can i hide any focus rectangle around the child activex, because once i select the hosted flowchart a focus rectangle surrounds it, so how can i remove this rect, although that rectangle never appears around any hosted activex (only around the hosted flowchart)?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Pass the kbd actions to hosted activex
Reply #1 - Feb 18th, 2010 at 12:16pm
Print Post  
1. Better use a control array or repeater to achieve that, or you would probably also have troubles attaching event handlers. Otherwise you might try sending the keystrokes to the hosted flowcharts by means of the windows API functions. You can get the hwnd handle of a hosted flowchart like this -

Dim hostedFC As Object
Set hostedFC = fcx.ActiveBox.AxControl
Dim h As Long
h = hostedFC.hwnd

and use the handle in Win32 functions such as PostMessage and SetFocus.

2. Try setting the ShowFocusFrame property of hosted flowcharts to false.
  
Back to top
 
IP Logged
 
andrewsando1973
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Feb 14th, 2010
Re: Pass the kbd actions to hosted activex
Reply #2 - Feb 18th, 2010 at 10:27pm
Print Post  
1) Can you please give me an example code, like a code for passing the arrow key action to the hosted flowchart.

2) etting the ShowFocusFrame property of hosted flowcharts to false doesn't help, the frame is still there, do you have other suggestions?

Thank you so much for your support.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Pass the kbd actions to hosted activex
Reply #3 - Feb 19th, 2010 at 12:58pm
Print Post  
2. Maybe you are seeing the box.WindowFrame and not a keyboard focus frame. Try setting WindowFrame to cbNone.

1. I've found the actual control handle is a child of the hWnd returned by the Box, so you can get the hosted control like this:

Code
Select All
Dim hostedFC As Object
Set hostedFC = box.AxControl
Dim h As Long
h = hostedFC.hwnd
h = Tools.GetWindow(h, Tools.GW_CHILD) 



where the Tools module contains the Win32 function definitions. Now in theory this should send a WM_KEYDOWN for the left key, but it doesn't work.

Tools.SendMessage h, &H100, vbKeyLeft, 0

It seems the arrow and del keys are blocked by VB6 forms, and even the flowchart control doesn't get them through a Windows message but through some COM interface. As a workaround you might set the following:

Code
Select All
fcx.KbdActive = False
fcx.KeyboardFlags(fHandleKeyDownInTranslAcc) = True 



and handle the KeyDown event raised by FlowchartX. Then if the reported key is Delete or an arrow key, call the respective method of the flowchart hosted inside the ActiveBox to either delete an item or move it in some direction.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint