Re: [gtk-list] alignment

On Thu, 15 May 1997, Sascha Ziemann wrote:

> Hi,
> I tried to put a icon, a label and a hot key label in a menuitem. For
> this I put a hbox in a menuitem and put the three widgets in it with
> different alignments. I want the icon left, the label left and the
> hotkey label right. So I set the x alignment of the icon and the label
> to 0 and that of the hotkey label to 1. But that has not the effect I
> expected. The icon and the hotkey label are ok (left and right). But the
> label is centered and a bit shifted left. Anybody here who knows what
> went wrong?

Sorry if this has already been answered - I mysteriously got unsubscribed 
from the mailing list this morning.

The alignment setting only affects the positioning of the widget contents 
within its allocation. But what you want to do is to make the allocation 
of the hotkey label aligned with the right side of the menuitem. No 
problem: use gtk_box_pack_end (). Here's the code you'll need:

menuitem = gtk_hbox_new (FALSE, 5);
gtk_box_pack_start (GTK_BOX (menuitem), icon, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (menuitem), label, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (menuitem), hotkey_label, FALSE, FALSE, 0);

Hope this helps!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]