0

I'm running a webapp on Android galaxytab. I have 3 textbox with FocusHandler-s erasing the textbox content onFocus. This works well but if the user uses the tab, previous or next buttons on the device's keyboard, the FocusEvent is not triggered.

I tried to catch Key events to prevent default action on TAB but the tab key is not triggerd either.

Does anyone know how to trigger a FocusEvent on tab or previous/next key press on an Android device keyboard? (Everything works well in computer's browser even if using tab key the focus event is triggered but not in Android's browser).

Chris Cashwell
  • 22,308
  • 13
  • 63
  • 94
Alexis
  • 131
  • 2
  • 11

2 Answers2

0

While this isn't a fix for your FocusHandler issue, if the content in the textbox that is being erased is a placeholder, perhaps you can benefit from this answer.

Community
  • 1
  • 1
Chris Cashwell
  • 22,308
  • 13
  • 63
  • 94
  • Placeholder seems to be a good solution but I'm unable to change the placeholder style. I'm using .myInput::-webkit-input-placeholder{ color: #FFF; font-style:italic; } but nothings change even on my webbrowser (chrome) – Alexis Jan 16 '12 at 09:43
  • Placeholders won't solve my problem because I need to call some function et the onFocus call. – Alexis Jan 16 '12 at 10:00
  • Placeholders won't solve my problem because I need to call some function during onFocus call. For Example I'm calling DOM.setCapture() then releasing it when onBlur's triggered or on every click away from the textbox. – Alexis Jan 16 '12 at 10:07
  • @Alexis RE: being unable to style placeholder- perhaps try not targeting a specific field, but rather **all** input fields that contain placeholders: `::-webkit-input-placeholder { color:#f00; }` (chrome/safari) or `input:-moz-placeholder { color:#f00; }` (firefox) – Chris Cashwell Jan 16 '12 at 14:39
  • I tried using ::-webkit-input-placeholder { color:#f00; }but id dosn't work. I assume that has eclipse tell me there's an error after the first colon the code isn't well transmitted to the gwt output. – Alexis Jan 17 '12 at 09:24
  • You can make an external stylesheet for CSS that GWT doesn't like to parse. Then just reference the file in your HTML page. It's tricky getting some browser-specific CSS to parse correctly thru Flute (which GWT uses, and is only technically CSS2.1 compliant). – Chris Cashwell Jan 17 '12 at 12:15
  • That should work thank you. but I'm still stuck because i need to use the FocusEvent to be triggered for some treatement. I really don't understand why this event is not triggered when using next/previous/tab button from the galaxytab. – Alexis Jan 17 '12 at 13:44
0

Take a look at http://www.m-gwt.com

The library provides placeholders for input elements in gwt.

Daniel Kurka
  • 7,973
  • 2
  • 24
  • 43