Re: Gtk::TreeViewColumn::set_widget()



You don't want to do it that way.  you'll end up with a segfault when
you try to derefence the null pointer.

My guess is that the description for this particular function was
brought over from the GTK+ docs, since the GTK+ function used a
pointer as an argument.  In gtkmm, however, references are used in
preference to pointers, so the 'if the argument is 0' comment doesn't
make much sense since references can't be 0.

Often in these sorts of cases, gtkmm will use function overloading to
provide two different functions -- one with a reference argument and
one without the argument at all.  This doesn't seem to be the case
here, so it doesn't appear that it's possible to get this behavior in
gtkmm unless you call the GTK+ functions directly.  Or maybe there's
an alternate way to do it and I just don't know about it.

jonner


On 12/24/05, Shawn Artrip <ubergreatness yahoo com> wrote:
> Gtk::Widget * widget = 0;
> Gtk::TreeViewColumn::set_widget(*widget);
>
> this compiles fine but I don't know if it
> runs the way the doc says it will.
>
> On Sat, 24 Dec 2005 06:13:51 -0500
> Doug McLain <doug nostar net> wrote:
>
> > The docs at
> > http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1TreeViewColumn.html#f5c3b04accb5fba7aa4c84e831b8b643
> > say that if widget is 0, then a Label will be used.  I am passing 0 to
> > this function, but I get:
> >
> > error: no matching function for call to
> > 'Gtk::TreeViewColumn::set_widget(int)'
> > note: candidates are: void Gtk::TreeViewColumn::set_widget(Gtk::Widget&)
> >
> > How do I do this right?  I don't want to pass a real widget, I want it
> > to do exactly what the docs say it does when widget is 0.
> >
> > Doug
> > --
> > http://nostar.net/
> > _______________________________________________
> > gtkmm-list mailing list
> > gtkmm-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtkmm-list
> _______________________________________________
> 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]