VK_PLUS not recognised in menu shortcut

Discussion in 'Java' started by DBloke, Feb 20, 2008.

  1. DBloke

    DBloke Guest

    Hi,

    I am trying to use Ctrl + as a menu shortcut, and am passing the VK_PLUS
    with the ctrl shift mask but this will does not work.

    I have a uk keyboard and the + is above the = the VK_MINUS works fine,
    so I am guessing the problem is to do with the fact that + needs to be
    shifted.

    If I pass in just '+' as the char with a Ctrl Mask i get unknown error
    code 0x002b appear on the menu.

    Passing in just '+' works but does not with the Ctrl Key unsurprisingly.

    Is there a way to map the VK_EQUALS to VK_PLUS so that Pressing Ctrl =
    displays as Ctrl+ Plus on the menu text rather than Ctrl+ Equals?

    Thanks
    DB
     
    DBloke, Feb 20, 2008
    #1
    1. Advertising

  2. DBloke <> wrote:
    > I am trying to use Ctrl + as a menu shortcut, and am passing the VK_PLUS
    > with the ctrl shift mask but this will does not work.


    I don't really know myself, but:
    - does the big "+"-key on the numpad-part of the keyboard
    trigger that binding?
    - why would you bind something to a triple-keypress, anyway?
    - are you aware, that other keyboards (e.g. german)
    have a key with "+" in unshifted position?
     
    Andreas Leitgeb, Feb 21, 2008
    #2
    1. Advertising

  3. DBloke

    DBloke Guest


    > - why would you bind something to a triple-keypress, anyway?
    > - are you aware, that other keyboards (e.g. german)
    > have a key with "+" in unshifted position?
    >

    Hi, yes I am aware of this :) you have a sensible keyboard.
    I guess what I really want is to press Ctrl and = to trigger event but
    have Ctrl+ Plus display as the menu shortcut. similar to Firefox.

    Looking through the keystroke java class I can not see a way to change
    what text is displayed as the shortcut text in the menu item without
    effectively extending the calss if this is possible, copying the entire
    getkeytext method, overriding this in my class and pasting the sun
    method and have VK_EQUALS return Ctrl+ Plus rather than Ctrl+ Equals,
    this way I can capture the Ctrl + Equals key event but display Ctrl +
    Plus as the shortcut in he menu.

    Firefox use of this must map both equals and + to Ctrl Plus as doing
    either a Ctrl = or a Ctrl Shift + produce the same result.

    I can't believe this is the only way, I thought about overriding key
    Press events, intercepting Ctrl+ Equals and directing to method of
    interest and faking text in menu.

    Anybody got any better ideas?
    DB
     
    DBloke, Feb 21, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Uli
    Replies:
    1
    Views:
    427
  2. =?Utf-8?B?c2FtaWtkdXQ=?=

    System.Mail.MailMessasge.Fields() Not Recognised

    =?Utf-8?B?c2FtaWtkdXQ=?=, Feb 11, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    339
    =?Utf-8?B?c2FtaWtkdXQ=?=
    Feb 11, 2004
  3. JezB
    Replies:
    0
    Views:
    335
  4. JezB
    Replies:
    0
    Views:
    304
  5. Replies:
    0
    Views:
    355
Loading...

Share This Page