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 8997271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:52:02+00:00 2026-06-15T23:52:02+00:00

I’m currently programming a little Desktop application in c++ and it’s the first time,

  • 0

I’m currently programming a little Desktop application in c++ and it’s the first time, that I use gtkmm for it.

I followed the tutorials from here but all I get is a blank window. It worked before refacturing the MainWindow to its own class…

Please note: I have ommited the includes, usings and signal handler implementations.

This is my main-function:

int main(int argc, char **argv)
{
    RefPtr<Application> app = Application::create(argc, argv, "org.mw88.adbtool");
    //Main kit(argc, argv);

    RefPtr<Builder> builder = Builder::create();
    try
    {
        builder->add_from_file("Gui.glade");

        MainWindow *window = NULL;
        builder->get_widget_derived("MainWindow", window);
        app->run(*window);
        //kit.run(*window);
    }
    catch (const FileError& ex)
    {
        cerr << "FileError: " << ex.what() << endl;        
        return EXIT_FAILURE;
    }
    catch (const MarkupError& ex)
    {
        cerr << "MarkupError: " << ex.what() << endl;        
        return EXIT_FAILURE;
    }
    catch (const BuilderError& ex)
    {
        cerr << "BuilderError: " << ex.what() << endl;
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}

My MainWindow-Header:

class MainWindow : public Window
{
public:
    MainWindow(BaseObjectType* cobject, const RefPtr<Builder>& refBuilder);
    virtual ~MainWindow();
    void show(RefPtr<Application> &app);

private:
    RefPtr<Builder>     builder;
    ToolButton          *addButton;
    ToolButton          *editButton;
    ToolButton          *deleteButton;
    ToolButton          *connectButton;
    TreeView            *hostList;
    RefPtr<ListStore>   listStore; 
    Columns             cols;

    //Signal handlers:
    virtual void onAddClicked();
    virtual void onEditClicked();
    virtual void onDeleteClicked();
    virtual void onConnectClicked();  
};

This is the constructor for the MainWindow class:

MainWindow::MainWindow(BaseObjectType* cobject, const RefPtr<Builder>& refBuilder)
{
    this->builder = refBuilder;

    addButton = NULL;
    editButton = NULL;
    deleteButton = NULL;
    connectButton = NULL;
    hostList = NULL;

    builder->get_widget("hostList", hostList);

    builder->get_widget("addButton", addButton);
    addButton->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::onAddClicked));

    builder->get_widget("editButton", editButton);
    editButton->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::onEditClicked));

    builder->get_widget("deleteButton", deleteButton);
    deleteButton->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::onDeleteClicked));

    builder->get_widget("connectButton", connectButton);
    connectButton->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::onConnectClicked));

    hostList->set_model(listStore = ListStore::create(cols));
    hostList->append_column("Host", cols.host);
    hostList->append_column("Port", cols.port);

    for (int i = 0; i < 20; i++)
    {
        TreeModel::Row row = *(listStore->append());
        row[cols.host] = "Testhost";
        row[cols.port] = i;
    }

    show_all_children();
}

It seems that all Widgets are returned from the builder correctly but app->run only displays an empty Window. What could be the reason for that?

  • 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-06-15T23:52:03+00:00Added an answer on June 15, 2026 at 11:52 pm

    Your constructor isn’t complete, you need to initialize the base class with cObject:

    MainWindow::MainWindow(BaseObjectType* cobject, const RefPtr<Builder>& refBuilder)
      : Gtk::Window(cObject)  // add this
    {
        this->builder = refBuilder;
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I

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.