General XMetaL Discussion
XMetaL Community Forum › General XMetaL Discussion › Override the paste CTRL+V shortcut keys in XMAX 5.5
-
craig_83 March 19, 2010 at 4:27 pm
Override the paste CTRL+V shortcut keys in XMAX 5.5
March 19, 2010 at 4:27 pmParticipants 6Replies 7Last Activity 12 years, 10 months agoHi,
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
Derek Read March 19, 2010 at 5:20 pm
Reply to: Override the paste CTRL+V shortcut keys in XMAX 5.5
March 19, 2010 at 5:20 pmIf 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?
craig_83 March 22, 2010 at 9:00 am
Reply to: Override the paste CTRL+V shortcut keys in XMAX 5.5
March 22, 2010 at 9:00 amIt 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?
Derek Read March 22, 2010 at 11:32 pm
Reply to: Override the paste CTRL+V shortcut keys in XMAX 5.5
March 22, 2010 at 11:32 pmYes, you can do this. Something like the following (MCR source as viewed with a text editor):
[code]
ActiveDocument.Host.Alert(“you pressed Ctrl+V”); ]]> [/code]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
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.
scotth April 23, 2012 at 5:59 pm
Reply to: Override the paste CTRL+V shortcut keys in XMAX 5.5
April 23, 2012 at 5:59 pmI'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.
jrob61 March 9, 2016 at 6:59 pm
Reply to: Override the paste CTRL+V shortcut keys in XMAX 5.5
March 9, 2016 at 6:59 pmits been awhile since this was posted and hopeful someone has found a solution. We need to run special code to clean up the clipboard and are trying to intercept the keyboard cut and paste commands. We are using a vb.net mdi form that can host other forms that contain their own xmax 10.0 control. We have set the form's KeyPreview = true, but can't capture the Ctrl+X or Ctrl+V in any of the form's _KeyDown event. We were able to capture the key combinations in the xmax control's _PreviewKeyDown event – however, it carries out our special code and then proceeds with the normal copy (or paste).
jrob61 March 9, 2016 at 7:02 pm
Reply to: Override the paste CTRL+V shortcut keys in XMAX 5.5
March 9, 2016 at 7:02 pmregarding the paste, decided to perform a clipboard.clear after calling our special code. but, still hopeful better solution?
jrob61 March 31, 2016 at 8:07 pm
Reply to: Override the paste CTRL+V shortcut keys in XMAX 5.5
March 31, 2016 at 8:07 pmfrom the xmax control _PreviewKeyDown event:
If e.KeyCode = Keys.V And e.Modifiers = Keys.Control Then
e.IsInputKey = True
End If
from the form _KeyDown event:
If e.KeyCode = Keys.V And e.Modifiers = Keys.Control Then
e.Handled = True
gobjCurrentWrapper.ProtPaste() -
AuthorPosts
- You must be logged in to reply to this topic.