Re: [gtk-list] Gtk-- Entry Size



Kevin Handy wrote:
> 
> I want to create an entry widget that has been sized to
> approximately the number of characters that it can contain.
> (This gives a visual cue for the data entry people)
> The only size function I can find is the set_usize function
> which wants the size in pixels.
> 
> I've tried to use gdk_string_width, but it needs the font to use,
> and I cannot find a function to tell me what font the the entry
> field will use. I did come up with
> 
>         GdkFont* font = efield.get_style()->gtkstyle->font;
>         width = gtk_string_width(font, "X") * fieldsize;
> 
> but that will no longer compile with Gtk--0.11.1 (the error is
> 'gtkstyle is a protected member of class Gtk_Style').
> 

Try this
	GdkFont* font = efield.get_style()->gtkobj()->font;
>         
> So, what is the official way to set the size of an entry/label/...
> widget using Gtk--? Also how much space do you need to add for
> the border inside the widget? I don't want to hardcode the size of
> a character, because I end up with problems due to differences in
> X-Terminals/fonts, but it's beginning to look like that is going
> to be the only way to do it.
> 
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null

-- 
   ==============================================================
   | Todd Dukes                      E-MAIL:  tdukes@ibmoto.com |
   | Motorola Somerset                  Phone:   (512) 424-8008 |
   | MS OE70                                                    |
   | 6300 Bridgepoint Parkway Building #3                       |
   | Austin, Texas 78730                                        |       
   ==============================================================



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