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

The Archive Base Latest Questions

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

I want my heading on top and the next button on right bottom. But

  • 0

I want my heading on top and the next button on right bottom. But I am not able to do this. It is displaying next in middle right and heading little above bottom. And with next button I want to move to other window, here I am calling gtk_main_quit(). My code is:

#include <gtk/gtk.h>

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

        GtkWidget *window;
        GtkWidget *next;

        GtkWidget *align;
        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
        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(FALSE, 3);

        next = gtk_button_new_with_label("Next");
        gtk_widget_set_size_request(next, 70, 30);
        gtk_container_add(GTK_CONTAINER(hbox), next);
        halign = gtk_alignment_new(1, 0, 0, 0);
        gtk_container_add(GTK_CONTAINER(halign), hbox);
        align = gtk_alignment_new(0, 0, 1, 0);

        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));
        label = gtk_label_new("No. of projects are:\n");

        gtk_container_add(GTK_CONTAINER(vbox), label);

        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:04:50+00:00Added an answer on June 7, 2026 at 4:04 pm

    You add elements to vbox from top to bottom, so if you want the label to appear on top, you should move the lines:

        label = gtk_label_new("No. of projects are:\n");  
        gtk_container_add(GTK_CONTAINER(vbox), label);
    

    so that label is the first object that is added to vbox, right after where you initialize it.
    Then the “next” button will also move to the bottom right corner.

    There is a chapter in the GTK+ 2.0 Tutorial about this: Packing Widgets.

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

Sidebar

Related Questions

I have the following html: <div class=container> <img src=.../> <p>Heading</p> </div> I want this
I want to learn WPF but from all the commentary I've been hearing the
want to have a Hyperlink-Button in a gridView in which I can display a
Want the function to sort the table by HP but if duplicate HPs then
Want to be able to provide a search interface for a collection of objects
want to rewrite urls like site.com/software to wp-content/themes/dir/software.php and something is not working.. Here's
My JSON string looks like this, [{id : 38,heading : Can you also figure
How can I have this other box display at the bottom of the first
I want to be able to output data from PowerShell without any column headings.
My site structure looks like this: - top-level site --sub-site ---page ---page --sub-site ---page

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.