Re: Right justified text in labels




Owen Taylor <otaylor@redhat.com> writes:

> set_justify() only effects the alignment of lines for 
> multi-line labels. You want:
> 
>  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);

Yes, or rather 1.0 as the x-alignment, since I want right
justification. Marvellous!

> (Anybody want to write up a FAQ entry on this one?)

Sorry if this has been answered often in the past, but I just
joined. I should go and read the message archives, I guess.

> > Another thing I'd like to do, is to make an entry widget have a
> > more narrow width than it is given by default. The maximum number
> > of characters in the entry is 4, so how do I determine a reasonable
> > width?
> 
> Hmmm, maybe something like:
> 
>  gtk_widget_set_usize (label,
>                        gdk_string_width (label->style->font, "WWWW") + 6,
>                        -1);

Yes, just what I needed. Is there a less hard-coded way to account for
the border width, though?

Thanks for the help.

-- 
Lars Haugseth



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