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



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




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