You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by hrbaer <he...@gmail.com> on 2011/03/28 13:03:13 UTC

make link invisible via onclick

Hi,

is there a possibility to make a link invisible itself via onClick?
At the moment I get an error "The local variable link may not have been
initialized".

code:
----------------------
        final Link link = new Link( "test" ) {
        	
            @Override
            public void onClick() {
            	      link.setVisible( false );
            }
        };
----------------------

Thanks in advance.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/make-link-invisible-via-onclick-tp3411327p3411327.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: make link invisible via onclick

Posted by Josh Kamau <jo...@gmail.com>.
Hi,

How about something like this.

private Boolean isLinkVisible = true ;
...


final Link link = new Link("test"){

      @Override
     public void onClick(){
          isLinkVisible = false ;
    }

    @Override
    public void isVisible(){
       return isLinkVisible ;
    }

}

Kind regards.

Josh

RE: make link invisible via onclick

Posted by hrbaer <he...@gmail.com>.
this works like a charm - thanks.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/make-link-itself-invisible-via-onclick-tp3411327p3411347.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: make link invisible via onclick

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> is there a possibility to make a link invisible itself via onClick?


>             	      link.setVisible( false );

Sure: Just use "this" instead of "link", since "this" in the onClick() will be the anonymous object based on Link.

- Tor Iver

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org