0

I want to add 2 Widgets on same window one is of type gtk_drawing_area_new (); for using Cairo and other is of fixed to add some buttons.

Is there anyway I can do this on same Window? I'm new to GTK+.

1
  • I know I'm doing everything wrong only thing I want is to use Cairo and also use simple GTK functions like button and layout along with cairo Commented Jun 10, 2015 at 11:15

1 Answer 1

1

Use a GtkContainer subclass such as GtkHBox, GtkVBox or GtkGrid

GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
GtkWidget *drawingArea = gtk_drawing_area_new ();
GtkWidget *button = gtk_button_new_with_label ("Button");

gtk_container_add (GTK_CONTAINER (window), hbox);

gtk_box_pack_start (GTK_BOX (hbox), drawingArea, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);

gtk_widget_show_all (window);

You can see all the standard containers that are available here: https://developer.gnome.org/gtk3/stable/GtkContainer.html#GtkContainer.object-hierarchy

Sign up to request clarification or add additional context in comments.

1 Comment

What is the successor of gtk_widget_show_all? It's no longer in use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.