I while back I also wrote a library that corrects for keyboard events by returning a remapped ascii set. If you notice, keyboard events on IE and Netcape return different keycodes. I've made one mod to remap them and get the case right. May I suggest that be corrected as well. Also, there was an example I sent out that showed how to retrieve tab, shift+alt+del, enter, and even arrow keys regardless of platform or browser but it was in DynAPI 2.5. I haven't had the time to port it to 3.0 but I believe the code should be implemented, as keyboard support is rather poor to date.
----- Original Message ----- From: "Raymond Irving" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, August 22, 2003 9:11 AM Subject: Re: [Dynapi-Dev] Keyboard events in HTMLTextBox > > Point well taken. I'll see to it that your changes be > implemented inside the HTML form based components. > > -- > Raymond Irving > > --- Andrew Gillett <[EMAIL PROTECTED]> wrote: > > Hello, > > > > I have had a problem with capturing keyboard events > > in HTMLTextBox. I > > want to execute some code when the Enter key is > > pressed in a textbox, > > but while the keyboard event handling in HTMLTextBox > > works quite well it > > doesn't allow me to find out which key was pressed. > > > > The getInnerHTML function in htmltextbox.js > > contains: > > this._inlineEvents+=' onkeypress="return > > htc._e(\'keypress\',this);" ' > > +' onkeyup="return htc._e(\'keyup\',this);" ' > > +' onkeydown="return htc._e(\'keyup\',this);" ' > > > > The event handlers are invoked with two arguments: a > > String that give > > the kind of event and a reference to the TextBox > > object. The event > > handler in my own code gets the reference to the > > object but this doesn't > > let me find out which key was pressed. > > > > I have worked around this problem in my own copy of > > DynAPI by adding the > > "event" object to the arguments passed to the event > > handler: > > this._inlineEvents+=' onkeypress="return > > htc._e(\'keypress\',this,event);" ' > > +' onkeyup="return > > htc._e(\'keyup\',this,event);" ' > > +' onkeydown="return > > htc._e(\'keyup\',this,event);" ' > > ... > > > > The _e function also needs to change from: > > p._e = function(evt,elm){ > > var rt = this._oldHCTBEvt(evt,elm); > > to > > p._e = function(evt,elm,arg){ > > var rt = this._oldHCTBEvt(evt,elm,arg); > > > > > > This allows my own event handler two receive two > > parameters: the object > > that raised the event and the event itself. > > > > May I suggest this change be made to the library? > > I'm hoping it won't > > cause any cross-browser portability problems. > > > > > > > > On a slightly different matter, while I was poking > > about in > > htmltextbox.js, I noticed that line 72 contained: > > if(this.getElm()) this.elm.readonly=(b)? > > 'readyonly':''; > > > > The 'readyonly' looks like a typo which should > > probably be fixed. > > > > > > > > regards > > Andrew Gillett > > > > ps. I'm using the latest version for DynAPI3 from > > CVS. > > > > > > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: VM Ware > > With VMware you can run multiple operating systems > > on a single machine. > > WITHOUT REBOOTING! Mix Linux / Windows / Novell > > virtual machines > > at the same time. Free trial click > > here:http://www.vmware.com/wl/offer/358/0 > > _______________________________________________ > > Dynapi-Dev mailing list > > [EMAIL PROTECTED] > > > http://www.mail-archive.com/[EMAIL PROTECTED]/ > > > __________________________________ > Do you Yahoo!? > Yahoo! SiteBuilder - Free, easy-to-use web site design software > http://sitebuilder.yahoo.com > > ------------------------------------------------------- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0 _______________________________________________ Dynapi-Dev mailing list [EMAIL PROTECTED] http://www.mail-archive.com/[EMAIL PROTECTED]/