Re: [Pango] Calls to Pango::Layout without effect
- From: Bob Caryl <bob fis-cal com>
- To: Matthias Kaeppler <matthias finitestate org>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: [Pango] Calls to Pango::Layout without effect
- Date: Fri, 21 Oct 2005 09:24:22 -0500
Hey Matt:
I use a Gtk::MessageDialog in one of my apps, so I decided to put my own
advice into practice. I created a std::vector<Gtk::Widget *> and
created it with Gtk::MessageDialog::get_children.
std::vector<Gtk::Widget *> widget_list = db->get_children();
As it turns out it only returns one child object, and trying to treat it
as a label,
for(gint i = 0; i < widget_list.size(); i++)
{
printf("%d label = %s\n",i,(char *)((Gtk::Label
*)widget_list[i])->get_text().c_str());
}
gets the following result at run time:
(pricebook:2989): Gtk-CRITICAL **: gtk_label_get_text: assertion
`GTK_IS_LABEL (label)' failed
So, I guess I *was* all wet after all.
Bob
Matthias Kaeppler wrote:
Bob Caryl wrote:
I may be all wet here, but because the MessageDialog displays a lot
of things such as a graphic indicating the type of MessageDialog, a
separator bar graphic, a couple of buttons (at least) along with the
message it displays, I'd say that the pango context (which you don't
seem to be using) you're getting is *not* for the child widget that
displays the message in the MessageDialog window. I'd also say that
get a pango layout pointer you are creating using the Glib::ustring
that you're passing to the constructor function is not going to
affect the way the MessageDialog ultimately displays it.
That sounds reasonable; I figured it would be something like this.
However, since Nautilus also uses the pango layout returned by the
dialog, I still had hope it would work.
I believe that there is a child widget that displays that text, and
it will probably have its own pango layout; hence, maybe you could
somehow use Gtk::Container::get_children() and parse that list to
find the GtkLabel that is ultimately displaying the message. Again,
I'm guessing based on my cursory perusal of the MessageDialog header
and source files for gtkmm-2.6.2.
That's a good idea, I will look into this. Reading the MessageDialog
source code could also come in handy I guess. However, I don't want to
write code which relies on MessageDialog internals and which could
possibly be subject to change one day (which would render my code
useless). Have to be careful here :)
Oh yeah, the Gtk::MessageDialog::set_secondary_text method has a
second parameter that defaults to turning the use of markup text off.
Okay, thanks Bob.
Bob Caryl
Best Regards,
Matthias Kaeppler
_______________________________________________
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]