About focusing

Is it possible to make a TextField clear its initial text when it is focused for the first time? Also, it would be handy if a button could be linked with a TextField, so that pressing enter would fire the button. Currently I put TextFields inside a Panel and implement a keyboard listener in that panel. It would be nicer if I didn’t have to use Panels, though.

I’m also wondering if it’s a bug in Toolkit or my code that calling focus() on a component doesn’t work in IE6 or IE7. It only works in Firefox.

Not at the moment (with server-side code). It’s planned, see #1455 (
http://dev.itmill.com/ticket/1455
).

It would. There is some discussion about the subject in
http://dev.itmill.com/wiki/DevDocs/RFC/ShortCutKeys
. There’s also the ticket #875 (
http://dev.itmill.com/ticket/875
), although the inexplicable “fixed” status seems dubious.

Keyboard action handlers are currently bound to a Panel, because it’s a basic container for components (you can disable its decorations) and you usually want to have the keyboard actions work in all the components in a certain group such as a form. We have wanted to avoid having keyboard actions for each individual component.

That is odd, because it should work and works here on both IE 6 and 7. Which exact version of IE are you using? I presume you tried to focus TextField? If the problem persists, please file a ticket.

Yes, I tried to focus a TextField. My IE7 version is 7.0.5730.13 and my IE6 version is 6.00.2800.1106 (I use MultipleIEs) and my Toolkit version is 5.2.0.

My own guess is that there might be too many components on the page for the focus to work, or I’m doing something else wrong. Maybe I should just create a simple page to test this.

Sorry for the delayed reply.