Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    LinkItem as a Button

    I want the Linkitem to behave as a button. so instead of opening an URL I want it to listen to the Click event do some operation as in onClick just a IButton's onClick does. How can I?

    Thanks

    #2
    Can someone reply to this? How can I have Link to act like a Button?

    Comment


      #3
      Please reply to this one. I am looking like for button with a Hyperlink look n feel.

      Thanks

      Comment


        #4
        LinkItem but that is designed to open a new window. Addling click listeners is currently not supported but I've reported this feature request. You can try using GWT's Hyperlink instead.

        Code:
              Hyperlink googleLink = new Hyperlink("Google", "google");
                googleLink.addClickListener(new ClickListener() {
                    public void onClick(Widget sender) {
                        //
                    }
                });
        Sanjiv

        Comment


          #5
          The latest build / SVN now supports LinkItem.addClickHandler(..);

          Sanjiv

          Comment


            #6
            Hyperlink LinkItem and can't Layout.add() because there are not Canvas

            How to add Link on a Layout ?

            Code:
            final LinkItem linkItem = new LinkItem();
            final Hyperlink hyperlink = new Hyperlink();
            
            HLayout hLayout = new HLayout();
            hLayout.setMembers(hyperlink, linkItem); // The method setMembers(Canvas...) in the type Layout is not applicable for the arguments (Hyperlink, LinkItem)
            LinkItem extends Form, so we can't use outside a form.
            Hyperlink (GWT) not extends Canvas.
            So, how to display a link ?


            Another question about links : How to open a new page, like mouse click whell (whith Chrome browser, open new tab and not go inside) ?
            I have try com.google.gwt.user.client.Window.open(), but it's open a new tab and get the focus instead of stay on first page....

            Comment


              #7
              Add LinkItem to a DynamicForm and add the form to your Layout.

              Comment


                #8
                Always need LinkItem in a DynamicForm to display a link in text ?

                Greet, i'll try, but we always need LinkItem in a DynamicForm to display a link in text ?

                How to set a canvas to display any text contents texts and links ? like this :

                My any txt with a <link>link</link> and some text and the <link>last link</link>

                In this case, whe need use html content in Canvas, but now how to addClickHandler() on the two links in html code ?

                Comment


                  #9
                  plz answer to this question for me also same problem

                  Comment


                    #10
                    LinkItem extends Form, so we can't use outside a form.
                    Hyperlink (GWT) not extends Canvas.
                    So, how to display a link ?

                    Comment


                      #11
                      Originally posted by jaladanki_sunil
                      LinkItem extends Form, so we can't use outside a form.
                      Hyperlink (GWT) not extends Canvas.
                      So, how to display a link ?

                      Add LinkItem to a DynamicForm and add the form to your Layout.

                      Comment


                        #12
                        Just an Example

                        Originally posted by smartgwt.dev
                        Add LinkItem to a DynamicForm and add the form to your Layout.
                        Code:
                        		Layout vLayout=new VLayout(10);
                        		vLayout.setSize("100%", "100%");
                        		DynamicForm frmSignOut=new DynamicForm();
                        		LinkItem lnkSignOut=new LinkItem();
                        		lnkSignOut.setShowTitle(false);
                        		lnkSignOut.setLinkTitle("Cerrar sesión");
                        		lnkSignOut.addClickHandler(new ClickHandler(){
                        
                        			@Override
                        			public void onClick(ClickEvent event) {
                        				//TODO handle event
                        			}
                        			
                        		});
                        		frmSignOut.setFields(lnkSignOut);
                        		frmSignOut.setSize("100%", "20px");
                        		vLayout.addMember(frmSignOut);
                        		vLayout.draw();

                        Comment


                          #13
                          The code below may help u.
                          Code:
                          private FlexTable layout;
                          layout = new FlexTable();
                          private String loginPath = GWT.getHostPageBaseURL() +"Pinkcrm.html";
                          
                          layout.setHTML(13, 1, "Login" + "<a href = \""+ loginPath  + "\" + target=\"_blank\">" + Signup+ "</a>");

                          Comment

                          Working...
                          X