General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Override the paste CTRL+V shortcut keys in XMAX 5.5

  • craig_83

    Override the paste CTRL+V shortcut keys in XMAX 5.5

    Participants 6
    Replies 7
    Last Activity 12 years, 6 months ago

    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

    Reply

    Derek Read

    Reply to: Override the paste CTRL+V shortcut keys in XMAX 5.5

    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?

    Reply

    craig_83

    Reply to: Override the paste CTRL+V shortcut keys in XMAX 5.5

    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?

    Reply

    Derek Read

    Reply to: Override the paste CTRL+V shortcut keys in XMAX 5.5

    Yes, 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.

    Reply

    scotth

    Reply to: Override the paste CTRL+V shortcut keys in XMAX 5.5

    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.

    Reply

    jrob61

    Reply to: Override the paste CTRL+V shortcut keys in XMAX 5.5

    its 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).

    Reply

    jrob61

    Reply to: Override the paste CTRL+V shortcut keys in XMAX 5.5

    regarding the paste, decided to perform a clipboard.clear after calling our special code. but, still hopeful better solution?

    Reply

    jrob61

    Reply to: Override the paste CTRL+V shortcut keys in XMAX 5.5

    from 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()

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support