[928] in The GTK GIMP ToolKit mailing list archive
[gtk-list] [patch] set_uposition
daemon@ATHENA.MIT.EDU (Owen Taylor)
Wed Sep 10 01:34:57 1997
To: gnome@nuclecu.unam.mx
Cc: gtk-list@redhat.com
From: Owen Taylor <owt1@cornell.edu>
Date: 10 Sep 1997 01:33:29 -0400
In-Reply-To: Miguel de Icaza's message of Tue, 9 Sep 1997 22:54:55 -0500
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com
Windows being descendents of GtkBin, can only have one child widget.
However, if you use a container class, such as an HBox, that can have
multiple children, in theory set_uposition should work. In practice, a
one line bug-fix is needed to gtkwidget.c:
===========
*** ../../gtk+owt-081197/gtk/gtkwidget.c Sun Aug 10 13:54:06 1997
--- gtkwidget.c Wed Sep 10 00:58:08 1997
***************
*** 1035,1041 ****
real_allocation.y = aux_info->y;
}
! gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SIZE_ALLOCATE], allocation);
}
/*****************************************
--- 1044,1050 ----
real_allocation.y = aux_info->y;
}
! gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SIZE_ALLOCATE], &real_allocation);
}
/*****************************************
===========
With this patch the following works for me: (translation from
perl to Guile left as an excercise for the reader)
===========
#!/usr/bin/perl -w
use Gtk;
$window = new Gtk::Window "TOPLEVEL";
$window->set_title("Placement");
$window->border_width (10);
$window->signal_connect ("destroy", sub { Gtk->exit(0) });
$window->set_usize (200,200);
$bag = new Gtk::HBox (0, 0);
$window->add ($bag);
$bag->show;
# note use of set_alignment
$label = new Gtk::Label "Label1";
$bag->pack_start ($label, 1, 1, 0);
$label->set_uposition (50,50);
$label->set_alignment (0.0, 0.0);
$label->show;
$label = new Gtk::Label "Label2";
$bag->pack_start ($label, 1, 1, 0);
$label->show;
$label->set_uposition (75,75);
$label->set_alignment (0.0, 0.0);
$window->show;
Gtk->main;
=============
Regards,
Owen Taylor
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null