Announcement

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

    Onclick not fired upon 2nd click

    Hello,

    I was wondering if you could help me with a niggly problem.

    I have a button which triggers a PopupPanel to be created and displayed. This panel has a Close button which hides it from view. If I click on the button a second time, it doesn't work! I've tried everything I can think of, but can't sort this little problem, surely there is something obviously I am missing...

    Here is a test case of my code that you can run:

    Code:
    import com.google.gwt.core.client.EntryPoint;
    
    import com.google.gwt.user.client.ui.PopupPanel;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.Button;
    import com.smartgwt.client.widgets.HTMLPane;
    import com.smartgwt.client.widgets.Window;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.events.CloseClickHandler;
    import com.smartgwt.client.widgets.events.CloseClientEvent;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class TestEntryPoint implements EntryPoint {
    
        PopupPanel popupDocViewer;
    
        public TestEntryPoint(){
        }
    
        public void onModuleLoad() {
            VLayout vLayout = new VLayout();
    
            Button but = new Button("My Button");
            but.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    SC.say("OnClick event fired!");
                    windowPopup();
                }
            });
            vLayout.addMember(but);
            vLayout.draw();
        }
    
        private void windowPopup()
        {
            HTMLPane w = new HTMLPane();
            w.setTop(25);
            w.setWidth(400);
            w.setHeight(300);
            w.setIFrameURL("http://www.google.com");
    
            Window window = new Window();
            window.setTitle("Window Viewer");
            window.setWidth(500);
            window.setHeight(400);
            window.addCloseClickHandler(new CloseClickHandler() {
                public void onCloseClick(CloseClientEvent event) {
                    popupDocViewer.hide();
                }
            });
            window.addChild(w);
    
            popupDocViewer = new PopupPanel();
            popupDocViewer.setWidget(window);
            popupDocViewer.show();
        }
    }

    #2
    Probably a zIndex issue. Avoid this and all future similar issues by not mixing core GWT and SmartGWT widgets when it's not strictly necessary.. a Window can be show()n on it's own without a PopupPanel.

    Comment


      #3
      Thanks, I'll redevelop without PopupPanel... :-)


      Just so you know, if the focus is on the button, and I press Enter, it works. It just doesn't work with the mouseclick...

      Alan

      Comment

      Working...
      X