Re: how to test whether a Gtk::TreePath is null



Yeah i had discussed this in the IRC channel already once i think; in
our code we also need  to use gobj() to check if it's really NULL.

As sidenote one should of course use the return value of path_at_pos()
but there are other cases where it's not always guaranteed that a path
is actually valid (i don't remember the case i needed it for now but
it seemed neccessary)



On 8/31/07, Murray Cumming <murrayc murrayc com> wrote:
>
> On Fri, 2007-08-31 at 17:10 +0200, Ferenc Gerlits wrote:
> > Hi,
> >
> > There is a get_dest_row_at_pos() method in TreeView which sometimes
> > returns null for a TreePath.  The only way I could find for testing
> > whether the path is null is through gobj().  Code snippet:
> >
> > ...
> > Gtk::TreePath        path;
> > treeView->get_dest_row_at_pos (x, y, path, pos);
> >
> > if (path.gobj () != 0) {
> >      iter = treeModel->get_iter (path);
> > } else {
> >      iter = treeModel->append ();
> > }
> > ...
> >
> > Is there a reason why get_dest_row_at_pos() returns null instead of an
> > empty path?  And is there a better way for testing whether a TreePath is
> > null?
>
> Can't you use the bool return value of get_dest_row_at_pos()?
> http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1TreeView.html#2b526d239750a6f97ed15b3e5c0cc1de
>
> Maybe we need an operator bool() for TreePath, so we can do
> if(treepath). I don't think we've needed one before.
>
> --
> murrayc murrayc com
> www.murrayc.com
> www.openismus.com
>
> _______________________________________________
> 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]