Re: Inserting in the middle of a hbox
- From: Thomas Mailund Jensen <mailund daimi au dk>
- To: gtk-list redhat com
- Subject: Re: Inserting in the middle of a hbox
- Date: 26 Jan 1999 11:16:57 +0100
>>>>> "E" == Etienne Grossmann <etienne@anonimo.isr.ist.utl.pt> writes:
E> Hello,
E> I would like to know wether it is possible to insert elements at
E> an arbirtrary (that is, not at the beginning or at the end)
E> position in a hbox?
I don't think you can pack at arbitrary points directly, but you can
reorder children of a box with
void gtk_box_reorder_child (GtkBox *box,
GtkWidget *child,
gint position);
as in the attached program.
E> Also, is there any way to delete an element from a hbox?
I can't think of one...and I don't think there is...it would probably
cause all kinds of problems with the packing.
/mailund
===File ~/tmp/foo.c=========================================
#include <gtk/gtk.h>
int
main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *vbox;
GtkWidget *label;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
vbox = gtk_vbox_new (TRUE, 2);
gtk_container_add (GTK_CONTAINER (window), vbox);
label = gtk_label_new ("first");
gtk_box_pack_start_defaults (GTK_BOX (vbox), label);
label = gtk_label_new ("second");
gtk_box_pack_start_defaults (GTK_BOX (vbox), label);
label = gtk_label_new ("third");
gtk_box_pack_start_defaults (GTK_BOX (vbox), label);
if ( (argc > 1) && (strcmp (argv[1], "swap") == 0) ) {
gtk_box_reorder_child (GTK_BOX (vbox), label, 1);
}
gtk_widget_show_all (window);
gtk_main ();
return 0;
}
============================================================
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]