Re: DND in TreeView
- From: Deng Xiyue <manphiz gmail com>
- To: gtkmm-list gnome org
- Subject: Re: DND in TreeView
- Date: Sat, 28 Mar 2009 13:38:07 +0800
On Wed, Mar 25, 2009 at 02:18:04PM -0400, José Alburquerque wrote:
> On Wed, 2009-03-25 at 13:02 +0800, Deng Xiyue wrote:
> > So, with the given test program, what I'm experiencing is:
> >
> > 1. If I drag the last row in a TreeView to other place within the same
> > TreeView, no delete signal is emitted, only insert signal got signaled.
> >
> > 2. If I drag any row (that is not the last row) to the last position,
> > the insert signal always returns the path that evaluates to be row 0,
> > which is the first row. That way, I cannot distinguish whether the row
> > is dragged to the first row or the last row. Note that there are some
> > assertion message when dragging to to last position.
>
> Okay. I think that what you're experiencing is a side effect of when
> rows are inserted and deleted in the tree model (this can be very
> tricky). I think that you should use the path in the signal handlers
> instead of attempting to get an iterator to get the rows that have been
> inserted/deleted. The patch I've attached exemplifies how to do that.
> You'll probably have to make adjustment to the row numbers based on
> whether an insertion or a deletion has taken place (I'm not sure).
>
> If you have to get an iterator, you should make sure you're working with
> the right row because as the Gtk::Path[1] docs say, it is not guaranteed
> that a path will always yield a vaild TreeModel::iterator. HTH.
>
> [1]
> http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1TreePath.html
>
> --
> José Alburquerque
Sorry again for the delay of my reply.
Thanks a lot for the patch. It makes it clear that in both scenario the
delete signal is indeed emitted, but yields an invalid iterator, so my
code doesn't work. I also found I can use 'path[0]' to get an actual
usable index, which should be enough for my current use case, but please
do correct me if I'm still using a suboptimal way to achieve this.
Thanks again.
Regards,
Deng Xiyue
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]