Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 740593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:32:03+00:00 2026-05-14T08:32:03+00:00

I have Buttons attached to elements on the modules entrypoint html page using RootPanel.get(foo).add(button)

  • 0

I have Buttons attached to elements on the modules entrypoint html page using RootPanel.get("foo").add(button). If I subsequently create a LayoutPanel and attach it using RootLayoutPanel.get.add(layoutpanal) then the buttons cannot be clicked. This is all fine. If I then try and remove the layoutpanel or clear the RootLayoutPanel the buttons still cannot be clicked.

Any ideas how to clear this? Have I missed a step or should you simply never try and get back to using a page’s RootPanel if you have used a RootLayoutPanel?

Sample code:

public void onModuleLoad(){

    final LayoutPanel lp1=new LayoutPanel();

    ClickPanel ping=new ClickPanel("Ping");
    ping.getElement().getStyle().setBackgroundColor( "#fdd" );
    ping.addClickHandler( new ClickHandler(){
        @Override
        public void onClick( ClickEvent event ){
            Window.alert( "Ping!!!" );
            //lp1.removeFromParent();
            //RootLayoutPanel.get().remove(lp1);
            //RootLayoutPanel.get().removeFromParent();
            RootLayoutPanel.get().clear();
        }
    } );

    ClickPanel bong=new ClickPanel("Bong");
    bong.getElement().getStyle().setBackgroundColor( "#ddf" );
    bong.addClickHandler( new ClickHandler(){
        @Override
        public void onClick( ClickEvent event ){
            Window.alert( "Bong!!!" );
        }
    } );

    lp1.add( ping );
    lp1.setWidgetLeftWidth( ping, 100, Style.Unit.PX, 500, Style.Unit.PX );
    lp1.setWidgetTopHeight( ping, 100, Style.Unit.PX, 500, Style.Unit.PX );

    lp1.add( bong );
    lp1.setWidgetLeftWidth( bong, 50, Style.Unit.PCT, 600, Style.Unit.PX );
    lp1.setWidgetTopHeight( bong, 50, Style.Unit.PCT, 200, Style.Unit.PX );

    Button b=new Button("Click Me");
    b.addClickHandler( new ClickHandler(){
        @Override
        public void onClick( ClickEvent event ){
            RootLayoutPanel.get().add( lp1 );
        }
    } );
    RootPanel.get("button1").add( b );
}

ClickPanel is simply overrides HTMLPanel implementing HasClickHandelers. Clicking “Click Me” opens the layout panel. Clicking the panel ping gets rid of the layout panel, but the button “Click Me” cannot be clicked. I’ve tried various options.

Update

Calling RootPanel.get().remove(RootLayoutPanel.get()) removes the RootLayoutPanel clearing the LayoutPanel and allowing widgets on the RootPanel to be clickable. However it does causes something to get screwed up because any subsequent call to RootLayoutPanel.get.add() throws an
IndexOutOfBoundsException. So this is not the full answer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T08:32:03+00:00Added an answer on May 14, 2026 at 8:32 am

    Second StackOverflow question, second answer by myself. Is that bad?

    So, the first call to RootLayoutPanel.get() does two things; creates a RootLayoutPanel object, keeping a singleton reference to itself, and adds itself to the RootPanel by calling RootPanel.get().add().

    You can remove it using RootPanel.remove(RootLayoutPanel.get()) however this will still leave the singleton reference to RootLayoutPanel which will be returned if you call RootLayoutPanel.get(). Since this is not attached to anything you can’t add anthing too it without throwing an IndexOutOfBoundsException.

    To work around this you can manually reattach the RootLayoutPanel to the RootPanel with RootPanel.get().add(RootLayoutPanel.get()). Calling this even if the RootLayoutPanel is already attached doesn’t seem to do any harm… as far as I can tell.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 406k
  • Answers 406k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Addressing the second part of your question, you are quite… May 15, 2026 at 6:12 am
  • Editorial Team
    Editorial Team added an answer You can use the MySQL Connector which you can get… May 15, 2026 at 6:12 am
  • Editorial Team
    Editorial Team added an answer Sure, i've got Areas working with ASP.NET MVC 2. Its… May 15, 2026 at 6:12 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.