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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:20:13+00:00 2026-06-07T16:20:13+00:00

i want to display text on my window and a next button ,but when

  • 0

i want to display text on my window and a “next” button ,but when i am running code it is giving me error.

with next button i want to move to next window where i am displaying something else.
can somebody also tell me how to do this.

(try:1914): Gtk-WARNING **: Attempting to add a widget with type GtkVBox to a GtkWindow, but as a GtkBin subclass a GtkWindow can only contain one widget at a time; it already contains a widget of type GtkLabel

my code is:

#include <gtk/gtk.h>

int main (int argc, char *argv[])
{

        GtkWidget *window;
        GtkWidget *next;

        GtkWidget *label;
        GtkWidget *vbox;
        GtkWidget *hbox;
        GtkWidget *halign;
        GtkWidget *valign;


        gtk_init (&argc, &argv);

        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        gtk_window_set_title(GTK_WINDOW(window), "Center");//title position
        gtk_window_set_default_size(GTK_WINDOW(window),600,500);//size
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);//position
        label = gtk_label_new("Cold was my soul\n\
                        Untold was the pain\n\
                        I faced when you left me\n\
                        A rose in the rain....\n\
                        So I swore to the razor\n\
                        That never, enchained\n\
                        Would your dark nails of faith\n\
                        Be pushed through my veins again\n\
                        \n\
                        Bared on your tomb\n\
                        I'm a prayer for your loneliness\n\
                        And would you ever soon\n\
                        Come above onto me?\n\
                        For once upon a time\n\
                        On the binds of your lowliness\n\
                        I could always find the slot for your sacred key ");

 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
        gtk_container_add(GTK_CONTAINER(window), label);
        vbox = gtk_vbox_new(FALSE, 5);

        valign = gtk_alignment_new(0, 1, 0, 0);
        gtk_container_add(GTK_CONTAINER(vbox), valign);
        gtk_container_add(GTK_CONTAINER(window), vbox);

        hbox = gtk_hbox_new(TRUE, 3);

        next = gtk_button_new_with_label("Next");
        gtk_widget_set_size_request(next, 70, 30);
        gtk_container_add(GTK_CONTAINER(hbox), next);
        //      close = gtk_button_new_with_label("Close");
        //      gtk_container_add(GTK_CONTAINER(hbox), close);

        halign = gtk_alignment_new(1, 0, 0, 0);
        gtk_container_add(GTK_CONTAINER(halign), hbox);

        gtk_box_pack_start(GTK_BOX(vbox), halign, FALSE, FALSE, 0);
        g_signal_connect(G_OBJECT(next), "clicked",
                        G_CALLBACK(gtk_main_quit), G_OBJECT(window));

        gtk_widget_show_all(window);

        g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);


        gtk_main ();

        return 0;
}
  • 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-07T16:20:16+00:00Added an answer on June 7, 2026 at 4:20 pm

    The message is pretty clear: A GtkWindow can contain only one child widget but you have filled it already with the label. To achieve what you want, you have to add vbox (that is able to contain several widgets) to the window and then label to vbox.

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

Sidebar

Related Questions

I want to display some text in a inline popup window with ok/close button.
In my code,I want to display TextView text name as Toast message. I do
I want to display a very large text file but want to break it
I want to display warning messages in html. This code shows two text boxes
I want to open a window that will display some text like Validating input
I want to display a set of images (with associated text) on my window.
I have the password field on page. I want to display text Enter password
I want to display some text on twitter/facebook when a link is clicked on
I want to display some text for a few seconds and then quit my
In my XAML file I want to display this text which contains double and

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.