BUG: Numeric Keypad Accelerator bug...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

BUG: Numeric Keypad Accelerator bug...

Christopher J. Demers
I think we have discovered a bug regarding accelerators using the numeric
keypad.  When one sets an accelerator via the menu editor in the view
composer one can set "CTRL-NUM 1" by pressing the keys, and it works as
expected in the code.  However if one tries to set it programmatically it
does not work.  The problem seems to be that
AcceleratorTable<<keyCodeFromString: is returning the wrong number.

This code demonstrates the inconsistency:

vh := 0 asValue.
"Turn num lock on, execute the line bellow, put the focus on the entry
field, then press CTRL-1(on the numeric key pad) and close the window with
mouse."
(AcceleratorPresenter showOn: vh) .
"Now compare the values, they are not the same."
(AcceleratorTable keyCodeFromString:  'CTRL+NUM 1') "4643" = vh value
"4193".

Chris


Reply | Threaded
Open this post in threaded view
|

Re: Numeric Keypad Accelerator bug...

Blair McGlashan-2
"Christopher J. Demers" <[hidden email]> wrote in
message news:ba3p7r$p7alf$[hidden email]...
> I think we have discovered a bug regarding accelerators using the numeric
> keypad.  When one sets an accelerator via the menu editor in the view
> composer one can set "CTRL-NUM 1" by pressing the keys, and it works as
> expected in the code.  However if one tries to set it programmatically it
> does not work.  The problem seems to be that
> AcceleratorTable<<keyCodeFromString: is returning the wrong number.
>...

Thanks Chris, recorded as #1265. The error (a very long standing one I
think) is in Keyboard>>initializeVKeyMap, which attempts to set up a map
between key names and the virtual key codes defined in Win32 constants. You
can workaround this problem by updating the Keyboard class variable
VirtualKeys to include the correct codes, e.g.


0 to: 9 do: [:each | (Keyboard classPool at: 'VirtualKeys') at: 'NUM ', each
displayString put: 16r60+each]

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Numeric Keypad (and arrow keys) Accelerator bug...

Christopher J. Demers
"Blair McGlashan" <blair@no spam object-arts.com> wrote in message
news:[hidden email]...
> "Christopher J. Demers" <[hidden email]> wrote in
> message news:ba3p7r$p7alf$[hidden email]...
> > I think we have discovered a bug regarding accelerators using the
numeric
> > keypad.  When one sets an accelerator via the menu editor in the view
....
> Thanks Chris, recorded as #1265. The error (a very long standing one I
> think) is in Keyboard>>initializeVKeyMap, which attempts to set up a map
> between key names and the virtual key codes defined in Win32 constants.
You
> can workaround this problem by updating the Keyboard class variable
> VirtualKeys to include the correct codes, e.g.
...

The same bug seems to apply to the arrow keys as well.  Which explains why I
could not use them to control my game (see subject "Keyboard and Sound
questions...").

(AcceleratorTable keyCodeFromString: 'LEFT')  = 805
However the value from the AcceleratorPresenter when the left arrow key is
typed is 293.

Given the above, it may be worth reviewing the rest of the keyboard mapping
codes just to make sure they are correct.

Chris


Reply | Threaded
Open this post in threaded view
|

Re: Numeric Keypad (and arrow keys) Accelerator bug...

Blair McGlashan-2
"Christopher J. Demers" <[hidden email]> wrote in
message news:babiq0$rd0vm$[hidden email]...

> "Blair McGlashan" <blair@no spam object-arts.com> wrote in message
> news:[hidden email]...
> > "Christopher J. Demers" <[hidden email]> wrote in
> > message news:ba3p7r$p7alf$[hidden email]...
> > > I think we have discovered a bug regarding accelerators using the
> numeric
> > > keypad.  When one sets an accelerator via the menu editor in the view
> ....
> > Thanks Chris, recorded as #1265. The error (a very long standing one I
> > think) is in Keyboard>>initializeVKeyMap, which attempts to set up a map
> > between key names and the virtual key codes defined in Win32 constants.
> You
> > can workaround this problem by updating the Keyboard class variable
> > VirtualKeys to include the correct codes, e.g.
> ...
>
> The same bug seems to apply to the arrow keys as well.  Which explains why
I
> could not use them to control my game (see subject "Keyboard and Sound
> questions...").
>...

Thanks Chris, I think it potentially applies to all of the "extended" keys
that first appeared on the PC-AT keyboard.

Regards

Blair