PDA

View Full Version : Text Listening



urwitharup@yahoo.com
3 May 2009, 7:55 PM
Hello,

Have a very simple question. I want to have a listener to a Text component like "forgot my password", then a new TextBox like email id will be made visible or some thing to be done. How to do that? A code snipet will be really helpful.

Regards
Arup

Rvanlaak
3 May 2009, 11:26 PM
Use the Html class...

takayser
4 May 2009, 1:04 AM
try something like this:


final Text forgotPwd = new Text("forgot password");
forgotPwd.setTagName("span");
forgotPwd.setStyleAttribute("cursor","pointer");
forgotPwd.sinkEvents(Event.ONCLICK);
forgotPwd.sinkEvents(Event.MOUSEEVENTS);
forgotPwd.addListener(Events.OnClick, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
// put your action here, e.g. textField.setVisible(true);
}
});
forgotPwd.addListener(Events.OnMouseOver, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
forgotPwd.setStyleAttribute("color", "blue");
}
});
forgotPwd.addListener(Events.OnMouseOut, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
forgotPwd.setStyleAttribute("color", "black");
}
});

urwitharup@yahoo.com
6 May 2009, 3:35 PM
Thanks it works