Pages: 1
Print
Author Topic: Override the paste CTRL+V shortcut keys in XMAX 5.5  (Read 1501 times)
craig_83
Member

Posts: 36


« on: March 19, 2010, 10:27:47 AM »

Hi,

Can you tell me how I can override the paste CTRL+V shortcut in XMAX 5.5?

The control is wrapped in a Windows/WPF window. I am overriding the keystrokes on the WPF control the XMAX control is embedded in. However, the paste function fires before it reaches my (paste) override. It then fires my custom paste function, so the paste fires twice.

I have come to the conclusion that the XMAX control is handling the keyboard shortcut in the first instance (as I have tried handling keystrokes on all the other parts of the application). But I cannot find a way to access this keyboard shortcut and override it in the XMAX API.

Can you help? I am programming in C#.

Thanks
« Last Edit: March 19, 2010, 11:05:56 AM by craig_83 » Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 1550



WWW
« Reply #1 on: March 19, 2010, 11:20:50 AM »

If the container application doesn't handle a keystroke then it should pass it through to the ActiveX Control, whatever that control is, including XMAX. Normal behaviour for any container app on Windows (I hesitate to say "any" but I think this should be true for Microsoft products like IE, VB, C#, etc).

But it sounds like you're saying that XMAX is intercepting the paste first, rather that the application it is embedded inside?

Can you send a simple example that demonstrates this to XMetaL Support?
Logged
craig_83
Member

Posts: 36


« Reply #2 on: March 22, 2010, 03:00:40 AM »

It would be a little tricky to provide a simple example.

My basic question would be: Can you (directly) override keystrokes in the XMAX control, e.g. CTRL+V?
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 1550



WWW
« Reply #3 on: March 22, 2010, 05:32:13 PM »

Yes, you can do this. Something like the following (MCR source as viewed with a text editor):

Code:
<MACRO name="myPasteOverrideMacro" key="Ctrl+V" lang="JScript" hide="true"><![CDATA[

//perform an alternative to the basic paste action
ActiveDocument.Host.Alert("you pressed Ctrl+V");

]]>
</MACRO>

If you are building a customization using XMetaL Developer you would assign a value to the property called "ShortcutKey" for a specific script file (*.js, *.vb, etc) inside the solution. Then when that script is compiled into the MCR file during the build process some <MACRO> code similar to that shown above will be generated. See attached screen capture called MacroShortcutKeyAssignment.jpg

Is this what you are looking for?

This assumes that the keystroke has been passed through to XMAX and not intercepted first by the container application. If you wish to intercept the keystroke using the container application then you must code that there and deal with it (in which case you could then also tell XMAX to do something).

Note: this MCR functionality is the same for XMetaL Author with the one difference being that XMAX may not see certain keystrokes if they are intercepted by its hosting application.


* MacroShortcutKeyAssignment.jpg (41.58 KB, 402x536 - viewed 220 times.)
« Last Edit: March 22, 2010, 06:10:15 PM by Derek Read » Logged
scotth
Member

Posts: 35


« Reply #4 on: April 23, 2012, 11:59:09 AM »

I'm curious if anyone has had any luck with intercepting CTRL+V using a .NET container application, as Derek describes. I am trying to do this with XMAX 6.0, but am not having any luck with it. I am able to capture unused key combinations such as CTRL+A, but it seems like combinations such as CTRL+V, CTRL+C, CTRL+X, etc... are being handled before they make it to my form's KeyDown event. As a general rule, I have tried to avoid using macros in my customization, keeping all of my logic inside my container app, and I would ideally like to continue with that trend.
Logged
Pages: 1
Print
Jump to: