Re: DND on GTK - cancel attempt



"Veronika Irvine" <Veronika_Irvine oti com> writes:

> To allow a widget to participate as a drag source I have two options
> 1) gtk_drag_source_set and 2) gtk_drag_begin.
> 
> What I want to be able to do is when the conditions are right for a drag 
> to begin, I want to check if I indeed want to perform a drag (e.g. do I 
> have anything selected to drag).
> If I have nothing to drag, I do not want to proceed. 
> 
>  As far as I can gather, if I use gtk_drag_source_set I will be notified 
> in my drag_begin callback that the conditions for a drag to start have 
> been met.  But I can see no way in the drag_begin callback to abort the 
> operation (in fact calling gdk_drag_abort does not work and there is no 
> return value to indicate failure). 
> 
> Alternatively, I can detect that a DND operation may begin and then call 
> gtk_drag_begin but since the user can possibly configure the timing, 
> button used, distance moved etc I really can't do a good job of figuring 
> out when the DND operation may begin.

You need to go this route; the only thing that is configurable is
the distance moved, which is encapsulated in:

gboolean gtk_drag_check_threshold (GtkWidget *widget,
				   gint       start_x,
				   gint       start_y,
				   gint       current_x,
				   gint       current_y);

Regards,
                                        Owen



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