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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:39:18+00:00 2026-06-15T15:39:18+00:00

My project was to create a graphical application to help each employee to create

  • 0

My project was to create a graphical application to help each employee to create his own list of clients in a central database and the only problem I had was with the compatibility between gtk3 and gtk2. The project from beginning to end is based on gtk3 and then I realized that there are employees who use a system with gtk2 only. So I made some modifications to the implementation without much difficulty and works without any problem on its purpose. The last thing that I want to finish, is to simulate the function of the gtk_widget_get_hexpand() and gtk_widget_get_vexpand() … they are only in gtk3. For the other functions to work the same way as in gtk3 i did something like this:

#define gtk_grid_new() gtk_table_new(1,1,false)
#define GTK_GRID(x) GTK_TABLE(x)
#define GtkGrid GtkTable
#define gtk_grid_attach(x1,x2,x3,x4,x5,x6) gtk_table_attach(x1,x2,x3,x3+x5,x4,x4+x6,GTK_FILL,GTK_FILL,0,0)

To let the application work without the gtk_widget_get_hexpand() and gtk_widget_get_hexpand() functions, simply with:

#define gtk_widget_set_hexpand(x1,x2)
#define gtk_widget_set_vexpand(x1,x2)

Because is little more complex to simulate these functions with macros i tried to do something like this:

inline void gtk_widget_set_hexpand(GtkWidget* widget,gboolean expanded) {
    GValue value = G_VALUE_INIT;
    g_value_init(&value,G_TYPE_ENUM);
    if(expanded)
        g_value_set_enum(&value,GTK_EXPAND);
    else
        g_value_set_enum(&value,GTK_FILL);
    gtk_container_child_set_property(GTK_CONTAINER(gtk_widget_get_parent(widget)),widget,"x-options",&value);
}

inline void gtk_widget_set_vexpand(GtkWidget* widget,gboolean expanded) {
    GValue value = G_VALUE_INIT;
    g_value_init(&value,G_TYPE_ENUM);
    if(expanded)
        g_value_set_enum(&value,GTK_EXPAND);
    else
        g_value_set_enum(&value,GTK_FILL);
    gtk_container_child_set_property(GTK_CONTAINER(gtk_widget_get_parent(widget)),widget,"y-options",&value);
}

gtk_container_child_set_property()

I know that it is not correct! Actually i don’t know how to set the child properties of the widgets and more specific how to create a GValue with G_TYPE_ENUM. Can someone help me?

UPDATE: @ptomato gave me a better solution on this. Actually by using the gtk_container_child_set() function instead of the gtk_container_child_set_property() then:

#define gtk_widget_set_hexpand(x1,x2) gtk_container_child_set(GTK_CONTAINER(gtk_widget_get_parent(x1)),x1,"x-options",(x2)?(GTK_FILL|GTK_EXPAND):GTK_FILL,NULL);
#define gtk_widget_set_vexpand(x1,x2) gtk_container_child_set(GTK_CONTAINER(gtk_widget_get_parent(x1)),x1,"y-options",(x2)?(GTK_FILL|GTK_EXPAND):GTK_FILL,NULL);

does the trick successfully! Thanks to @ptomato!

  • 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-15T15:39:19+00:00Added an answer on June 15, 2026 at 3:39 pm

    Use gtk_container_child_set() instead:

    gtk_container_child_set(GTK_CONTAINER(gtk_widget_get_parent(widget)), widget,
        "y-options", expanded? GTK_EXPAND : GTK_FILL,
        NULL);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used that article on code project to create my own Captcha image, is
I am trying to create a modular sinatra application and need each of my
how to create project for native c++ executable in visual studio 2012. In previous
I have a project to create a program, which prevents the user from escaping
we are using wix project to create msi. We were trying to do major
In ZF you create a project by running this command: zf create project MyProjectName
I have a Create View page in my MVC3 project to create instances of
I've been assigned a project to create a file storage service on Google App
I m doing an eclipse plugin project to create an IDE. I need to
It seems to be added automagically in every project I create and I compile

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.