How to add buttons in Glade and resize

6,625

Solution 1

GTK+ uses box-based sizing, just like CSS and other modern tools. Also, a VBox will have all its children oriented vertically. You won't be able to add anything to the right.

You can use the GtkLayout for absolute positioning, or a GtkGrid to create a grid-based layout (which is appropriate for calculator).

Solution 2

You have two options:

  1. In the lower vbox pane, add a 'Grid' container. Your buttons will have all the same size and scale automatically with the window. There, you can increase the gaps between them by playing with the padding and border properties.
  2. Alternatively, add a 'Fixed' container. This will have the same behaviour as in visual basic, but it is not the gtk way.
Share:
6,625

Related videos on Youtube

Steve Sauls
Author by

Steve Sauls

Updated on September 18, 2022

Comments

  • Steve Sauls
    Steve Sauls over 1 year

    Trying to create the framework for a calculator.

    I add the window I add the vbox using 2 boxes. 1 for the display, the other for the buttons When I add 1 button it fills the entire panel and I can't resize it.

    In visual basic you can just add a button and resize it, or drag and drop anywhere you want.

    I just can't figure out how to do it here. Steep learning curve for me.

  • Steve Sauls
    Steve Sauls about 11 years
    That's closer to what I was looking for. Thx. But you still can't do drag and drop like in visual basic. Your pretty constrained in GTK but once I get used to it I am sure it will grow on me. This could be the reason some people use QT but to me QT is for KDE.
  • Steve Sauls
    Steve Sauls about 11 years
    Your response helped me also. Thx for the help