Re: Handle events from separate class?

2009-05-22 Thread Dalla
Oh that should have been obvoius i guess :) Thanks! One more question. You mentioned earlier that you can use id to identity sources if for example I add multiple buttons to the same ClickHandler. How do you set this Id in GWT? On 21 Maj, 17:46, Jim jim.p...@gmail.com wrote: public class

Handle events from separate class?

2009-05-21 Thread Dalla
I guess this question is not really GWT specific, but I haven´t been working much with handlers at all when developing web applications earlier. I´ll make a very simple example: public class EventManagerTest implements EntryPoint { public void onModuleLoad() { final

Re: Handle events from separate class?

2009-05-21 Thread Jim
Using GwtEvent.getSource() retrieves the source that last fired this event so you can differentiate event source widgets. Jim http://www.gwtorm.com - GWT ORM On May 21, 4:44 am, Dalla dalla_man...@hotmail.com wrote: I guess this question is not really GWT specific, but I haven´t been working

Re: Handle events from separate class?

2009-05-21 Thread Dalla
Yes, this I know. In this example the source would be the sendButton, right? But is there any way in which I can manipulate helloField when Handler is a separate class? Or do I have to make Handler an inner class inside EventManagerTest to be able to manipulate helloField? On 21 Maj, 15:35, Jim

Re: Handle events from separate class?

2009-05-21 Thread Jim
public class Handler implements ClickHandler { @Override public void onClick(ClickEvent event) { Widget widget = event.getSource(); if (widget instanceof TextBox) { TextBox textBox = (TextBox)widget; //do whatever you

Re: Handle events from separate class?

2009-05-21 Thread Dalla
I suppose this would work great if I actually clicked the textbox. But I want to change the text in the textbox when I click a button, not the textbox itself :-) On 21 Maj, 16:36, Jim jim.p...@gmail.com wrote: public class Handler implements ClickHandler {         @Override         public

Re: Handle events from separate class?

2009-05-21 Thread Jim
public class Handler implements ClickHandler { private TextBox textBox = null; public Handler(TextBox textBox ) { this.textBox = textBox; } } Jim http://www.gwtorm.com - GWT ORM http://code.google.com/p/dreamsource-orm/ On May 21, 11:18 am, Dalla