1. #1
    Ext User
    Join Date
    Apr 2009
    Posts
    33
    Vote Rating
    0
    brendand is on a distinguished road

      0  

    Default LinkButton

    LinkButton


    In asp.net, there is a control called a LinkButton. It looks like a link but behaves like a button. Is there a similar control is gxt, or a way to reproduce it.

    I'd like to have some code like this
    Code:
    		LinkButton logout = new LinkButton("Logout");
    		logout.addListener(Events.OnClick, new Listener<ComponentEvent>() {
    			@Override
    			public void handleEvent(ComponentEvent be) {
    ...
    			}
    		});
    I've tried with LabelField and Text, but I can seem to make either of them aware of when the user clicks on the link.

    My code so far is
    Code:
    Text logout = new Text("Logout");
    logout.setTagName("span");
    logout.setStyleAttribute("cursor","pointer");
    logout.addListener(Events.OnClick, new Listener<ComponentEvent>() {
    	public void handleEvent(ComponentEvent be) {
    		Info.display("click", "moo");
    	}
    });
    RootPanel.get().add(logout);

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,756
    Vote Rating
    113
    sven is just really nice sven is just really nice sven is just really nice sven is just really nice sven is just really nice

      0  

    Default


    You need to sink the click event.