Re: DND event->y for dropping on clist




Todd Dukes <tdukes@ibmoto.com> writes:

> I have a clist that I use for context sensitive pop-up menus and for
> dropping things on.
> 
> When I detect a mouse button I can use the coordinates to detect
> what item the mouse was over and construct the pop-up menu accordingly.
> 
> When I get a drop target the y coordinate is different (is wrong to 
> strong a word here?). It appears to include the size of the label
> buttons. I can't use the y coordiante to determine which list item
> the drop should hit.
> 
> Is this a bug or a feature? 

Not suprisingly, the DND code in GTK+ doesn't have special
knowledge of CLists. The coordinates in the drop event are
always relative to the widgets allocation.

(As opposed to the mouse events, which are relative to
the GdkWindow the mouse is currently in.)

The translation isn't completely trivial - the following
code should work.

 gint ty;

 gdk_window_get_position (GTK_CLIST(clist)->clist_window, 0, &ty);
 y_coord = y - ty - GTK_CONTAINER (clist)->border_width;
 
> Should I activate a different drop target for dropping on clist?

It would be nice to have code in GtkCList/CTree for activatingg
dropping/dragging from particular rows. Nothing like that
exists yet, though there are plans to work on it.

Regards,
                                        Owen 



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