How to bind _special_ shortcut keys to a Command programmatically?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: msnews.microsoft.com (-_at_hotmail.com)
Date: 08/21/04

  • Next message: Bennett Haselton: "any way to add tables to remote database in Server Explorer?"
    Date: Sat, 21 Aug 2004 13:16:35 +0200
    
    

    Hi,

    I would like to write a short macro, which programmatically sets some of my
    favorite Command shortcut keys.

    What I figured out that it can be done via assignment to Command object's
    Bindings array property.
    For example if I want to assign 'Ctrl + D' to Edit.GotoDefinition command I
    execute the following program code:

    DTE.Commands.Item("Edit.GoToDefinition").Bindings = New Object()
    {"Global::Ctrl+D"}

    ...and it works properly.

    The problem is that I have two "ezoteric" favorite Shortcut key:

    1) Ctrl + Num + ( The second plus means the plus on numeric keypad.)
    2) Ctrl + 5 (This is the five key on numeric keypad, with _num lock off_)

    Note, that both assignments can be done with no problem interactively in the
    user interface, I've been using them for years.
    Theese two keys introduce similar, but a little different problem.
    Both end with 'Invalid parameter' error message.

    When we inspect 1) it seems to be the second '+' sign fools the parser
    algorithm.
    But what is the expected syntax in this case?

    The 2) is more complicated. The full story is that if I set this key
    interactively, it works, but the user interface displays
    not 'Ctrl + 5' but 'Ctrl +'.
    Also if I inspect the Commands Bindigs array with a debugger after this
    interactive setting, I can see a one element string array, and the first
    element's value is "Ctrl +".
    Of course trying to execute the
    DTE.Commands.Item("Edit.ToggleOutliningExpansion").Bindings = New Object()
    {"Text Editor::Ctrl+"}
    leads to an error message.

    Q: How can I assign this two key programmatically?

    Q': The problem is not only about this two keys. The main problem is, that
    inspecting and saving the Command's Binding array content, and later
    restoring this values does not work in some cases because the Bindings does
    not accept the original found values:
    Two sample:

    'Global::Ctrl+Num +"
    or
    "Text Editor::Ctrl+"

    Any idea?

    thx for help


  • Next message: Bennett Haselton: "any way to add tables to remote database in Server Explorer?"

    Relevant Pages

    • bringing ee up to date
      ... -is a simple screen oriented text editor. ... +.\" To format this reference page, use the command: ... -Turn off display of information window at top of terminal. ... -.Ss "Control keys" ...
      (freebsd-hackers)
    • Re: Great SWT Program
      ... the keys standard with those keyboards are; ... I've had occasion to use xfig to make diagrams for inclusion in LaTeX ... Yours I assume includes a command name at least as long as ...
      (comp.lang.java.programmer)
    • 2nd Try: How to bind _special_ shortcut keys to a Command programmatically?
      ... favorite Command shortcut keys. ... What I figured out that it can be done via assignment to Command object's ... Bindings array property. ... Theese two keys introduce similar, ...
      (microsoft.public.vsnet.ide)
    • Re: How to bind _special_ shortcut keys to a Command programmatically?
      ... > favorite Command shortcut keys. ... > Bindings array property. ... > Theese two keys introduce similar, ... > Both end with 'Invalid parameter' error message. ...
      (microsoft.public.vsnet.ide)
    • Re: When will MS fix the WinCE USB Mass Storage Problems?
      ... In SCSIGetSenseData under SENSE_UNIT_ATTENTION, some keys reported ... I think the spec does not say that this is a valid response to this command, ... In the mean time I got about 50% of my non-working USB keys working. ... Attachdevice fails, the sequence of state-transitions there, fails. ...
      (microsoft.public.windowsce.platbuilder)