1. Keyboard Input (Win32Lib Question)

Hi all,

I'm getting keyboard input using Win32lib (I'm still using version 0.20d if
it makes a difference).

What I am interested in for the purpose of the program I am working on, is
the *position* of the keys, as opposed to their actual letter or number
value.  What I am doing is making a virtual "piano keyboard", so, for
instance, I am making the computer keyboard's "qwertyui" = "abcdefgabc" on
the piano keyboard.

I started out by using onKeyPress.  It worked OK, but I realized that I
will run into a problem if anyone running my program is using certain
international keyboard layouts that remap the keyboard.  For instance, in
the German keyboard layout, the "z" key is where the "y" key is in the
English (United States) layout.  Then "qwertyui" becomes "qwertzui" and I'm
in trouble.

Other international layouts make various changes in the keyboard layout
along these lines, from what I understand.

What I want, is to be able to map the "qwerty" row of the keyboard to
"cdefgabc" regardless of whether any international keyboard layout is selected.

I thought maybe "onKeyDown" will do this for me.  Supposedly it returns
"key codes", although I'm not sure exactly what is meant by the term "key
codes".

Will "onKeyDown" do the trick, or does anyone know a (relatively) simple
way to solve this problem?

Thanks in advance!

--Brent




+++++++++++++++++++ Brent Hugh / bhugh at griffon.mwsc.edu ++++++++++++++++++
+   Missouri Western State College Dept of Music, St. Joseph, Missouri   +
+               Piano Home Page: http://www.mwsc.edu/~bhugh              +
+ Internet Piano Concert:  http://cctr.umkc.edu/userx/bhugh/recital.html +
++++++++++ Classical Piano MP3s http://www.mp3.com/brent_d_hugh ++++++++++

new topic     » topic index » view message » categorize

2. Re: Keyboard Input (Win32Lib Question)

On Sun, 12 Dec 1999 18:05:46 -0600, Brent Hugh <bhugh at CSTP.UMKC.EDU> wrote:

>Hi all,
>
>I'm getting keyboard input using Win32lib (I'm still using version 0.20d if
>it makes a difference).

You might want to take the time to download the latest version from the
recent user contributions page.  It's much more feature rich with html
documentation.  The documentation still needs some work but that's
something I'll need to take up with David.

>What I am interested in for the purpose of the program I am working on, is
>the *position* of the keys, as opposed to their actual letter or number
>value.  What I am doing is making a virtual "piano keyboard", so, for
>instance, I am making the computer keyboard's "qwertyui" = "abcdefgabc" on
>the piano keyboard.

You will want to use onKeyDown instead of onKeyPress since onKeyDown will
return a scan code instead of a key code (which, as you noted, can change
depending on your OS language).  Scan codes will return the same value
regardless of what the key represents.  With a 'piano' type application,
you might also find onKeyUp to be rather useful (also returns a scan code).

-- Brian

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu