OnKeyUp getting lost.

G

Graham McKechnie

Hi all,



Warning a bit long winded - but I really would appreciate some feed back on
this problem from you guys who commonly write custom controls.



The background to the problem. I'm presently writing an app that has to work
on an Intermec 700 series device. One of the problems we face is that the
users of this app are wearing industrial gloves and at times full protective
gear as they are handling medical waste. Therefore most of the controls of
the compact framework are of little use to us as they are way too small to
be tapped with a gloved finger and the use of a stylus is not considered
practical with gloved fingers. Just about all input to the program is
controlled by the built in barcode scanner of the device



I've been designing menu controls that act like buttons, but also have
accelerators (numbers), images as well as text. The users are mostly
unskilled and English is not likely to be their first language in some of
the countries where the app will be used, hence the accelerators and images.
We believe that the numeric keyboard of the device will probably be used
just as commonly as tapping the buttons.



Herein lies the problem. The menu buttons are a collection of controls that
is controlled by another control I call a MenuBar. The MenuBar control has
overrides on OnMouseDown, OnMouseUp, OnClick, OnKeyDown, OnKeyPress and
OnKeyUp. Basically the Downs and Ups determine which button need
invalidating. The key..xxx events give visual feed back of the button
bouncing, just as would expect a tap would do.



This all works fine, if the user, uses all taps or all keyboard. It comes
unstuck when there is a combination of both taps and keyboard. The one
particular sequence that is a problem is when the user, uses the keyboard to
select a menu button, which then opens another window which contains another
set of menu buttons. If the user selects the cancel button (on the second
window) via the keyboard accelerator, then that window closes and the
original window is again visible and all the buttons appear ok. However if
instead of selecting the cancel button via the keyboard, the user taps the
cancel button, then the window closes, but the original button (on the first
window) which was used to open the second window, is now shown with that
button still depressed. It would appear that the final OnKeyUp of the first
window is lost.



I've put break points in the code on all the methods mentioned above and it
always behaves correctly if all taps or all keyboard. Its only when you
start with the keyboard and then revert to taps on the second window, that
the last keyUp of the first window is lost and hence the original button is
still drawn as depressed.



I've tried this with vs 2003 and vs 2005 beta and the behavior is identical.
To me it feels like a bug, because I don't understand where the final keyUp
event is going or what is eating the event. However I thought I would ask
here as I might be over looking something.



PS The device is running SP3.



Graham
 
D

Daniel Moth

Please create a small sample and post that so we can play with and make sure
we understand your scenario. I understand that given your "button/menu
framework" this might be hard but, personally, without a sample to run I
cannot offer any advice.

Cheers
Daniel
 
G

Graham McKechnie

Daniel,

Thanks for your reply. Yes I can create a small sample that demonstrates the
keyUp getting lost. It only needs two forms to demonstrate. I can email it
to you later today, as you are the only person who seems to be interested.
Is there any one from MS who is interested in receiving the example?

I've since worked around the issue by overriding OnGotFocus in the MenuBar
class and setting all the menuPanelCollection's Pressed property to false
and then invalidating the MenuBar which will redraw all the buttons. That is
a sledge hammer solution though, that shouldn't have been required if the
keyup hadn't disappeared.

Graham
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top