Re: Gtk_CTree : Help please



On Fri, 4 Aug 2000, Florent. Devin wrote:

> Vlad Harchev a écrit :
> 
> > > But with this method, I can not still handle signal for different
> > > gtk_ctree_node ? If I can not handle signal, I can not do drag and drop
> > > from
> > > another widget to a particular node.
> > 
> >   If you mean that you want to be able to drag something from other widget
> > (other ctree for example) to given ctree - yes, seems some tricky things will
> > be required to do this. Look at testdnd.c supplied in gtk sources. You will
> > have to do just the same (using "drag_drop" and "drag-data-received"), and in
> > handler for "drag-data-received" you will have to compute the row number of
> > the target it using
> > 
> >   int row, column;
> >   gtk_clist_get_selection_info(GTK_CLIST(root_ctree),x,y,&row,&column);
> >  After that you can (I guess) get the target CTreeNode using
> >   gtk_ctree_node_nth(GTK_CTREE(root_ctree),row)
> > 
> >  Please report whether this really works.
> > 
> >  If you need only dragging from nodes of that ctree to nodes of the same ctree
> > (better called reordering) - then it's easily doable (look at testgtk.c).
> > 
> > > There is one function that may help me but I do not know what it is for
> > > :
> > > gtk_ctree_set_drag_compare_func
> > > Or is there a way to handle drag and drop signal ?
> > > Is there a way to handle at least signal from gtk_widget ?
> > >
> What I have to do is :
>  - To drag a particular node from a ctree to another ctree or to the
> same 
> 	but in another location (changing the parent...)
>  - To drag from a canvas and drop onto a particular node

  In this case all you can use is native gtk drag-n-drop capabilities (as I
described in the message you've quoted).

>  - To drag from ctree to my canvas.
> So I can handle the signal from "drag-data-received" but how can I be
> sure that the current selected item is the item I what to drag ?

 Of course you'll have to handle "drag-drop" - in which you can cancel drop
operation (don't request for data that will cause emission of
"drag-data-received") 

> How can I know where I drop my drag object ?

 Handlers for both  "drag-data-received" and "drag-drop" receive the
coordintaes of the drop. This should be enough :)
 See testdnd.c for more ideas.

> I had a similar problem in canvas, where gnome-canvas-image are not from
> GtkWidget, the thing I have to do is to handle signal from the canvas
> itself and react if I was on an image or not. This was possible because
> gnome-canvas had function to know what we have under the pointer ?
> 
> -- 
> Florent DEVIN
> 

 Best regards,
  -Vlad





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