Robust (cross-browser) check for a specific keycode?
Hi, Can I reliably (cross-browser) check for a specific keycode using the following code: public void onKeyDown(Widget sender, char keyCode, int modifiers) { if ( 191 == (int)keyCode) { // question mark Window.alert("help"); } } TIA, jec --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Robust (cross-browser) check for a specific keycode?
Not always, this particular manifests itself for special keys like the cursor keys etc. I believe quirksmode has a good table/chart which tables keycodes. Perhaps a good future enhancement might be for GWT to normalize the differences so developers can code without being aware if these quirks. Unfortunately while most of the time the codes are the same across all browsers there will of course in the spirit of browser coding be exceptions to the rule often enough to make you angry:). On Apr 7, 12:26 pm, Jeff Chimene wrote: > Hi, > > Can I reliably (cross-browser) check for a specific keycode using the > following code: > > public void onKeyDown(Widget sender, char keyCode, int modifiers) { > if ( 191 == (int)keyCode) { // question mark > Window.alert("help"); > } > > } > > TIA, > jec --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Robust (cross-browser) check for a specific keycode?
On Apr 6, 8:35 pm, mP wrote: > Not always, this particular manifests itself for special keys like the > cursor keys etc. To be fair, according to the docs, KeyboardListener does guarantee cursor movement keys. > I believe quirksmode has a good table/chart which > tables keycodes. Thanks for the pointer. I had completely forgotten about quirksmode. > Perhaps a good future enhancement might be for GWT to > normalize the differences so developers can code without being aware > if these quirks. Unfortunately while most of the time the codes are > the same across all browsers there will of course in the spirit of > browser coding be exceptions to the rule often enough to make you > angry:). Yeah, the particularly depressing quote: "When I discovered that I decided not to risk my sanity by performing further punctuation character experiments." Here's the problem I'm trying to solve. While I like SuggestBox, I don't like the idea that the user has to perform a treasure hunt. I'd like to display a list of available suggestions on demand or display the list in response to an OnFocus event or combining ListBox and SuggestBox in a custom widget. I've got a lot of work to do for this particular program. For now, I'll stick with "?" as a debugging aid. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Robust (cross-browser) check for a specific keycode?
jchimene, The idea of a suggestBox.showDefaultSuggestions() has been tossed around. That would get you the initial list of suggestions that you're looking for. Unfortunately, this feature didn't make it into GWT 1.6 and I don't think there's even an issue open to track it. But if you're interested, you can take a look at a "ComboBox" I've been playing with in my SimpleGWT project (link below). That might get you closer to what you want and some feedback might actually encourage me to put time into that library again. ;) http://code.google.com/p/simple-gwt/ Hope that helps. Isaac On Tue, Apr 7, 2009 at 11:01 AM, jchimene wrote: > > > > On Apr 6, 8:35 pm, mP wrote: >> Not always, this particular manifests itself for special keys like the >> cursor keys etc. > > To be fair, according to the docs, KeyboardListener does guarantee > cursor movement keys. > >> I believe quirksmode has a good table/chart which >> tables keycodes. > > Thanks for the pointer. I had completely forgotten about quirksmode. > >> Perhaps a good future enhancement might be for GWT to >> normalize the differences so developers can code without being aware >> if these quirks. Unfortunately while most of the time the codes are >> the same across all browsers there will of course in the spirit of >> browser coding be exceptions to the rule often enough to make you >> angry:). > > Yeah, the particularly depressing quote: > "When I discovered that I decided not to risk my sanity by > performing further punctuation character experiments." > > Here's the problem I'm trying to solve. While I like SuggestBox, I > don't like the idea that the user has to perform a treasure hunt. I'd > like to display a list of available suggestions on demand or display > the list in response to an OnFocus event or combining ListBox and > SuggestBox in a custom widget. > > I've got a lot of work to do for this particular program. For now, > I'll stick with "?" as a debugging aid. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Robust (cross-browser) check for a specific keycode?
On Apr 7, 8:11 am, Isaac Truett wrote: > jchimene, > > The idea of a suggestBox.showDefaultSuggestions() has been tossed > around. That would get you the initial list of suggestions that you're > looking for. Unfortunately, this feature didn't make it into GWT 1.6 > and I don't think there's even an issue open to track it. But if > you're interested, you can take a look at a "ComboBox" I've been > playing with in my SimpleGWT project (link below). That might get you > closer to what you want and some feedback might actually encourage me > to put time into that library again. ;) > > http://code.google.com/p/simple-gwt/ I get the feeling that there are too many possibilities for a showDefaultSuggestions() implementation. Also, SuggestBox may not be a particularly popular widget. Thanks, I'll take a look at the code. I notice that simple-gwt is 1.6 based. I want to stay at 1.5 as long as possible, as I just don't want the 1.5 -> 1.6 learning curve right now. If I can work ComboBox into the current code, I'll let you know. Cheers, jec --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Robust (cross-browser) check for a specific keycode?
Well, I found myself moving to 1.6 sooner rather than later - mostly to take advantage of the Eclipse plug-in. Yes, I could have stayed on 1.5 even with the plug-in, but it was a slow news day. So, I will take a look at the library Cheers, jec --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Robust (cross-browser) check for a specific keycode?
On Apr 7, 8:11 am, Isaac Truett wrote: > jchimene, > > The idea of a suggestBox.showDefaultSuggestions() has been tossed > around. That would get you the initial list of suggestions that you're > looking for. Unfortunately, this feature didn't make it into GWT 1.6 > and I don't think there's even an issue open to track it. But if > you're interested, you can take a look at a "ComboBox" I've been > playing with in my SimpleGWT project (link below). That might get you > closer to what you want and some feedback might actually encourage me > to put time into that library again. ;) > > http://code.google.com/p/simple-gwt/ > > Hope that helps. > > Isaac Thanks, this looks quite usable. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---