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

  • SEARCH
  • Home
  • 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 7698407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:14:06+00:00 2026-05-31T22:14:06+00:00

Hi I use GWT and I have a com.smartgwt.client.widgets.Button that has the following eventHandler:

  • 0

Hi I use GWT and I have a com.smartgwt.client.widgets.Button that has the following eventHandler:

        Button viewCommentsButton = new Button("View ");
        viewCommentsButton.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                if (!childrenVisible) {
                    addChildren();
                    getParent().setTitle("Close");
                } else {
                    removeChildren();
                    getParent().setTitle("View");
                }
            }

        });

As you can see I tried getParent().setTitle() method but with no effect. The if works fine so I guess I can’t get the reference to my button object but the code compiles and getParent returns a widget so most likely my button.

However, the addChildren and removeChildren methods are working properly but my button has the initial title all the time. Any ideas why? Hope this makes sense.

Any suggestions are welcomed. Thanks.

  • 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-31T22:14:07+00:00Added an answer on May 31, 2026 at 10:14 pm

    If you are trying to set the title on viewCommentsButton, call viewCommentsButton.setTitle().

    If you are trying to set the text in the button, call viewCommentsButton.setText().

    For either of these you’ll have to mark the button as final – declare it with final Button viewCommentsButton = ...

    The context of getParent() is confusing. getParent(), the way you’re using it, will return the parent of the widget in which you’re defining all of this, NOT the parent of viewCommentsButton and definitely not viewCommentsButton itself.

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

Sidebar

Related Questions

Why does GWT have two element types? you have com.google.gwt.dom.client.Element & com.google.gwt.user.client.Element - when
I have a view that I created in my GWT application and I would
I am trying to use : http://code.google.com/p/jspf/ within a GWT framework. I know that
I need recommendations from people whom have implemented an easy to use GWT editable
I have been using UIBinder on SmartGWT widgets rather successfully. However, I have to
I would like to use Gwt-Validation with Gwt 2.4.0. I have in my gwt.xml
I have a grails project and I use the gwt plugin 0.6.1. GWT version
I have a monolingual GWT application (English) and I would like to use localized
I have wanted to use a HashMap that maps a value of type String
I'm relatively new to gwt and I have a problem using JsArrayInteger. Here is

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.