tree : moving items in the tree.



Hi !

I am trying to work with GtkTree.
I want to move a TreeItem in a tree as I want from place to place in that
tree.

Here is my example:

 +-A root Item
   + Item 1
       -Moving item

There is "A root Item" which contains an "Item 1". This item contains "Moving
Item".

FIRST QUESTION:
===============
    I want the "Moving Item" to be appended to the item (either "A root Item"
or "Item 1") on which I click on.
    Ex: I start on clicking on "A root Item", "Moving ITem" is removed from
"Item1" and appended to "A root Item".
        then I click on "Item 1", "Moving ITem" is removed from "A root
Item" and appended to "Item 1".

  But, when I do this 2nd step, "Item 1" is collapsed" and when I expand it,
the "Moving Item" would not appear.
   I need to collapse "Item 1" again and to exapnd it again, then "Movin Item"
appears.

    This bug does not happen when I put another Item in "Item 1":

     +-A root Item
       + Item 1
           - Item 11
           - Moving item

Any idea why?.


SECOND QUESTION:
==================

What I am trying to do is to move the "Moving Item", here is the scenario:
    1- when I click on "A root Item", "Moving Item" is removed from " Item 1"
and appended in "A root Item".
    2- Then, when I click on "Moving Item", "Moving Item" is removed from "A
root Item". (So it is no more visible. I referenced it not to loose it)

But I am having a problem at this 2nd step.
Gtk-CRITICAL **: file gtkwidget.c: line 4811 (gtk_widget_ref): assertion
`GTK_IS_WIDGET (widget)' failed.

It seems that I can not use the "select" signal of the "Moving Item" to move
it.


If any one would have any suggestions, I would really really really appreciate
it.

Thanks a lot.


Alex.



PS: Here are my call back functions:

static void change_parent_to_root_item (GtkWidget *treeItem)
{
 gtk_object_ref (GTK_OBJECT (Moving_Item));

 gtk_tree_remove_item (GTK_TREE (subtree_of_Item_1), Moving_item);

 gtk_tree_append (GTK_TREE (subtree_of_root_Item), Moving_Item);

 gtk_object_unref (GTK_OBJECT (Moving_Item));

 printf ("Change parent to root item !!!!\n");
}


static void change_parent_to_void (GtkWidget *treeItem)
{
 gtk_object_ref (GTK_OBJECT (Moving_Item));

 gtk_tree_remove_item (GTK_TREE (subtree_of_root_item), Moving_Item);

 printf ("Change parent to void !!!!\n");
}




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