Hi Jeff, My fields ARE wrapped in a FormPanel (which I assume is what you mean by "a form". If not, please enlighten me), and hitting Enter after selecting a file most certainly did NOT cause the Form to submit, because if it did, I wouldn't need to spend time making a button to accomplish that behavior.
Happily, Ian Bambury pointed me to sinkEvents and addHandler, which let me do what I want to do. As for the off topic: 1: I don't think I've EVER used HTMLPanel. If my UI gets bogged down, I'll keep it in mind, but my performance issues generally involve waiting for the server to finish queries. How many items do you need on screen to get client performance to bog down? 2: I spent (wasted?) several hours (probably over a day, spread out over a week) trying to make sense of UIBuilder. The documentation made no sense to me, and was totally lacking in worthwhile examples that I could play with to try to figure things out. (No, "go look at the rewritten Mail Application" doesn't qualify as a worthwhile example. A small working application that I can fiddle with, modify, and see what the changes do is what you need for a worthwhile example.) 3: "Much more readable" to whom? A UI Designer who doesn't read code? Great. But I'm not one of those, and I'm not working with one of those. For me, I go to the method that creates the Panel, and can quickly see what is where, and with who. Since my Widgets tend to have names like "dataFileUploaderForm", I generally know what's in them w/o having to look farther than the name, but if I do, a quick search on the name of any widget in the panel takes me to the method where it's put together. What does UIBuilder offer that's better than that? (Serious question. I'm a big fan of visual UI builders, but I've never understood the benefits of a textual one.) 4: My (half-remembered) impression of UIBuilder was that it was supposed to "encourage" you to move to the 2.0 LayoutPanels, rather than the 1.x Panels. No? Greg On Jan 5, 11:36 am, Thomas Broyer <[email protected]> wrote: > On Wednesday, January 5, 2011 4:14:47 PM UTC+1, Greg Dougherty wrote: > > > Hi Jeff, > > > You've got things backwards for my concerns. I want to fire off a > > Submit event when the user hits Enter, I don't want to do something > > special once the user has clicked on the button. > > I think Jeff got it right, but explained it badly: if you wrap you fields > inside a form, then when hitting Enter, the *browser* will submit the form. > So all you have to do is to listen to the SubmitEvent on the FormPanel (and > not the ClickEvent on the SubmitButton, which I believe not all browsers do > dispatch in this case). > > To do that, I need to figure out how to catch a KeyPress Event when > > > the last thing selected was a FileUpload (which doesn't have a > > KeyPress Event Handler). Any ideas? > > I just saw that Widget#addDomHandler is public, so this should work (for any > widget provided the browser actually dispatches the event): > fileUpload.addDomHandler(enterbutton, KeyPressevent.getType()); > > Now, let's go off topic: > > As for using UIBinder: > > > 1: I'm building the UI, and I'm a programmer. I LIKE building the UI > > programmatically. > > 2: When I looked at it (July - August 2010), the documentation was > > opaque, and singularly lacking in useful examples. So avoiding > > UIBuilder is faster than using it. > > Probably because you: > - don't use HTMLPanel enough (reminder: it helps for performance) > - and haven't spent the necessary hour (half-hour?) to learn how to use it > and understand how much time it can actually save you (mainly by making your > UI code much more readable as to which widget contains what). > > > 3: I build WebApps where the height and width of the UI is dependent > > upon the data returned in response to user actions. Which means that > > the *LayoutPanels are a HUGE step backward in functionality for me. > > To the extent that when I have to choose between "upgrading" GWT, and > > losing the non-Layout Panels, I'll probably stop upgrading GWT. (Yes, > > I know that the change was a deliberate choice. I just think it was a > > horrible mistake.) > > I don't see the relationship between layout panels and UiBinder. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
