Re: Setting size of SpinButton
- From: Lars Clausen <lrclause cs uiuc edu>
- To: gtk-list gnome org
- Subject: Re: Setting size of SpinButton
- Date: 31 Jan 2001 12:49:35 -0600
On 31 Jan 2001, Lars Clausen wrote:
> On 31 Jan 2001, Havoc Pennington wrote:
>
>>
>> Lars Clausen <lrclause cs uiuc edu> writes:
>>> I'm looking at a SpinButton that goes from -100.0 to 100.0, and the
>>> Entry field turns out too small -- when you're at -10.0 or below, the
>>> digits get cut off. From the spinbutton example in the tutorial, I
>>> just see the gtk_widget_set_usize, which is not friendly to different
>>> fonts etc. Is there a way I can say 'This spinbutton should be large
>>> enough to accommodate "-100.0"'?
>>>
>>
>> Not really, though we have a bug filed to implement that for 2.0. At
>> the moment you would need to get gdk_string_width() for -100.0 using
>> widget->style->font.
>
> Thanks, that sounds like a reasonable solution. Curiously, I have to
> multiply the width I get with 1.5 to get one that actually works.
I stand corrected. I had to add a bit to allow for the arrows.
Unfortunately, since SpinButton is an Entry, I can't just set the usize of
the Entry and get the right result. This hack won't work right with other
themes, I'm afraid.
I have the exact same problem with GtkMenu, it doesn't like to resize
itself to accomodate longer items (even when prompted with
gtk_widget_queue_resize()). Instead I find the longest item and set that
as usize, adding a but to allow for border and handle. Not a pretty sight,
but better.
-Lars
--
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause) | Hårdgrim of Numenor
"I do not agree with a word that you say, but I | Retainer of Sir Kegg
will defend to the death your right to say it." | of Westfield
--Evelyn Beatrice Hall paraphrasing Voltaire | Chaos Berserker of Khorne
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]