PVR
PVR

Reputation: 2524

OnLoad Event of GWT Widget like TextBox, TextArea

I want to catch the onLoad Event of TextBox. But I am not finding any handler through which I can call it. GWT provides LoadHandler for the same purpose. But I don't know how should I instantiate the Load Event from TextBox.

Any help would be appreciable!!!

Upvotes: 1

Views: 328

Answers (3)

Priyanka.Patil
Priyanka.Patil

Reputation: 1197

TextBox extends ValueBoxBase which has a protected method called onLoad().

All you have to do is the following

public class MyTextBox extends TextBox
{

  @Override
  protected void onLoad() {
   //Do your stuff
  }
}

Upvotes: 1

A1exandr Belan
A1exandr Belan

Reputation: 4780

textBox.addAttachHandler(new Handler() {
  @Override
  public void onAttachOrDetach(AttachEvent event) {
   if (event.isAttached()){

     doMyOnLoadMethod();

   }
  }
});

Upvotes: -1

Suresh Atta
Suresh Atta

Reputation: 122026

It seems you are looking for addAttachHandler() .

If you are designing an custom textbox implement the interface HasAttachHandlers .

Upvotes: 1

Related Questions