Hi

I have the following code which suppose to do the following:

1) when the login button is clicked, it will clear the RootPanel and show a
logout hyperlink,

2) when the logout hyperlink is selected, it will clear the RootPanel and
show the login button again.


public class Dummy implements EntryPoint, ValueChangeHandler<String> {

public void onModuleLoad() {
History.addValueChangeHandler(this);
displayLogin();
}

private void displayLogin() {
Button ok = new Button("Login");
ok.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
displayContent();
}
});
RootPanel root = RootPanel.get();
root.clear();
root.add(ok);
}

private void displayContent() {
Hyperlink logout = new Hyperlink("Logout", "logout");
RootPanel root = RootPanel.get();
root.clear();
root.add(logout);
}

public void onValueChange(ValueChangeEvent<String> event) {
if (event.getValue().equals("logout")) {
displayLogin();
}
}
}


The problem is when tested in hosted mode, the hyperlink stops responding
after the 1st time:

1) Login button is clicked, show logout hyperlink

2) Logout hyperlink is selected, show login button

3) Login button is clicked, show logout hyperlink

4) Logout hyperlink is selected, and NOTHING happen here!


Do you have any idea of what could be the problem?


-- 

Hez

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to