RE: [gtkmm] Wrapping a label when it exceeds width of parent?



Gtk::TextView probably has much better text wrapping. It is designed for
large amounts of text. That Gtk::Label text wrapping does sound strange.

Murray Cumming
www.murrayc.com
murrayc usa net

> -----Original Message-----
> From: gtkmm-list-admin gnome org 
> [mailto:gtkmm-list-admin gnome org] On Behalf Of Maurizio Colucci
> Sent: Dienstag, 16. Dezember 2003 15:19
> To: gtkmm-list gnome org
> Subject: [gtkmm] Wrapping a label when it exceeds width of parent?
> 
> 
> hello,
> 
> for the project   http://segusoland.sourceforge.net (see 
> screenshots), I have 
> the following widget hierarchy:
> 
> scrolled window
> --viewport
> ----vbox1
> ------hbox1
> --------togglebutton1
> ----------hbox2
> ------------image1
> ------------vbox2
> --------------label_name
> --------------label_dir
> --------------label_size
> --------------label_date
> --------button1
>      ....
> 
> Unfortunately, the scrolledwindow (and therefore also the 
> viewport and vbox1) 
> has a very low width, and the filenames are very long.
> 
> So I need to wrap the filenames: I need to add newlines to 
> label_name and 
> label_dir so they don't cross the right boundary of the 
> scrolledwindow.
> 
> (Of course I tried to set the wrap flag of gtk labels, but it 
> wraps at a fixed 
> width, hard-coded. Why on earth?)
> 
> In order to wrap correctly, I must take into account:
> 1) the width of image1
> 2) the width of button1 (which can also be hidden!)
> 3) the current font width, and the width in pixels of a 
> string with a given 
> font
> 4) the width of the scrolledwindow//viewport/vbox1 in pixels
> 
> But I don't know how. I am totally clueless. I really need 
> help about the 
> techinque... I need to use pango? How? I also couldn't figure 
> out how to get 
> the pixel width of a widget, not mention the pixel width of 
> the text redered 
> so far...
> 
> I beg your help,
> 
> Maurizio
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org http://mail.gnome.org/mailman/listinfo/gtkmm-list
> 



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