Problem with key events in dockable windows

T

thomas.klaus

Hi there,

We use dockable windows to show own forms and controls. Now we have a
problem with several key presses. For example, a textbox has the focus
within a dockable window, now when the user presses the Delete key,
the selected shape will be removed from the Visio drawing, when I only
want to delete a character in the textbox! How can I avoid that the
Keyevent gets through to Visio? I can catch the KeyUp event in the
textbox and can handle the Delete, but I don't know how to avoid that
this key gets through to Visio...

The strange thing is in a Combobox it works! That means the delete
keys removes one char without deleting the selected shape.

Many thanks in advance.
Tom
 
C

Chris Roth [Visio MVP]

Hi Tom,

It's bedtime here in Vienna, so I don't have more time to look into
this, but you might search the Visio Developer Help for:

OnKeystrokeMessageForAddon

I think this has something to do with what you need.

--
Hope this helps,

Chris Roth
Visio MVP


Visio Guy: Smart Graphics for Visual People
http://www.visguy.com
 
T

thomas.klaus

Chris,

Thanks for your reply.

I have a C# Visio COM-AddIn and i'm trying to catch the
OnKeystrokeMessageForAddon event. But unfortunetaly an event is never
caught.

Here is the C# code for a dockable window:
Window visioWindow = visibleVisioDocument.Window.Windows.Add(
findElementForm.Text,
tagVisWindowStates.visWSAnchorLeft |
tagVisWindowStates.visWSAnchorAutoHide |
tagVisWindowStates.visWSVisible,
tagVisWinTypes.visAnchorBarAddon,
0, top, width, height, null, null, null);
visioWindow.OnKeystrokeMessageForAddon +=
visioWindow_OnKeystrokeMessageForAddon;

Thanks for your help.
Tom
 
M

Mark Nelson [MS]

You should try declaring your visioWindow object globally rather than
locally. Otherwise it will go out of scope and the event handler will be
terminated.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
T

thomas.klaus

Hi Mark,

Thanks for your answer. I tried to set the visioWindow and the event
handler object globally. I even tried to catch the event on the
application, but without success. You got any hints for that?

Thanks!

Regards,
Tom
 
M

Mark Nelson [MS]

Take a look at the event stream from Visio using the EventMonitor tool (part
of Visio's SDK) to make sure that the event is firing.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
T

Tom Klaus

Mark, the event OnKeystrokeMessageForAddon is not even listed in the
event options of the EventMonitor tool of Visio 2007!

Tom
 
M

Mark Nelson [MS]

Hmm, quite right. I need to investigate that further.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top