Re: Re:Ctree drag and drop - fixed
| From: | Alan Knowles | Date: | Wed, 28 Nov 2001 08:38:57 +0000 |
| Subject: | Re: Re:Ctree drag and drop - fixed | ||
| References: | 1 2 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-729@lists.php.net to get a copy of this message | ||
ok, work this one out..
function drop_recieved($widget, $context, $x, $y, $data, $info, $time,$extra) {
$info = $this->widget->get_selection_info($x,$y) ;
if (is_array($info)) {
$node = $this->widget->node_nth($info[0]);
if ($node)
echo serialize($this->widget->node_get_row_data($node));
}
}
just wish there was a way to 'highlight' the node about to be dropped onto...
regards
alan
Alan Knowles wrote:
I'm trying to get drag and drop working for a ctree = dragging from a clist to a ctree. now I can get all the events to occur, but I need to figure out what node of the ctree the drop happened with.. looking at the gtk source, the widget should export x and y, the clist (which is what ctree extends) should export row_height if I apply the patch below... it could be done something like $y (comes from drop event) $row =($y - $ctree->y )/ $ctree->row_height; $ctree->node_nth($row); Any better ideas? regards alan ps. -- just realized that widget->x & widget->y are not in gtk2, ctree is also depreciated :) Index: gtk.defs =================================================================== RCS file: /repository/php-gtk/ext/gtk+/gtk.defs,v retrieving revision 1.13 diff -u -r1.13 gtk.defs--- gtk.defs 13 Nov 2001 09:17:33 -0000 1.13 +++ gtk.defs 28 Nov 2001 07:58:36 -0000@@ -40,6 +40,10 @@ (in-module Gtk) (parent Object (Gtk)) (c-name GtkWidget) + (field (type-and-name gint x)) + (field (type-and-name gint y)) + (field (type-and-name gint width)) + (field (type-and-name gint height)) (field (type-and-name GtkStyle* style)) (field (type-and-name GdkWindow* window)) (field (type-and-name GtkAllocation allocation)) @@ -554,6 +558,7 @@ (field (type-and-name GList* selection)) (field (type-and-name GtkSelectionMode selection_mode)) (field (type-and-name GList* row_list)) + (field (type-and-name gint row_height)) ) (object CTree