Re: Widget's Fixed Size??



Thanks for your prompt response.
Although I have not tested your suggestion, I had a look at the code and fond some parts of it intriguing, specially the part about 'Gtkmm2ext' I have never seen this in the documentation, not that I have read the entire gtkmm-doc, but I had done a fair amount of reading.
I did a quick search on google and found that this code is part of project called 'Ardour', a media thing.
I am using WinXP, and that program has not yet been ported to lesser operating systems like MSW. But that's another point.
I would appreciate if you  elavorate more on the 'Gtkmm2ext' matter.
 
Again thanks for your imput.
 
* You cannot exercise your power to a point of humiliation.
- Jean Chretien

* It's amazing how the small seeds of distrust and misunderstanding
can yield a crop of hate and death...

* If that document has fine printing anywhere, just chuck it in the garbage
- Jorge Escalante
Ma'assalama! Adiós! bye!
 
 
-----Original Message-----
From: Paul Davis <paul linuxaudiosystems com>
To: jalqadir netscape net
Cc: gtkmm-list gnome org
Sent: Sat, 07 Jan 2006 21:43:44 -0500
Subject: Re: Widget's Fixed Size??

On Sat, 2006-01-07 at 21:34 -0500, jalqadir netscape net wrote:
>  Is there a way to make a Gtk::Entry widget to have a fixed size? How
> do I do this?

any_widget.set_size_request (width_pixels, height_pixels);

width_pixels or height_pixels can be -1 to leave that dimension "unset".

but its generally a bad idea to do this without some knowledge of font
dimensions, hence you really want something more like:

void
Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w, const
gchar *text,
                           gint hpadding, gint vpadding)

{
    int height = 0;
    int width = 0;

    w.ensure_style ();
    w.create_pango_layout(text)->get_pixel_size (width, height);

    height += vpadding;
    width += hpadding;

    w.set_size_request(width, height);
}



Try the New Netscape Mail Today!
Virtually Spam-Free | More Storage | Import Your Contact List
http://mail.netscape.com

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