[PHP-GTK-DEV] drag-data-received - get_path_at_pos(x,y) wrong result?

[email protected] (ecc)
Newsgroups php.gtk.dev
Message-ID <[email protected]>
I´ve the some problems with my program like mentioned by kksou some days ago.

http://www.kksou.com/php-gtk2/articles/use-drag-and-drop-to-shift-rows-in-a-GtkTreeView---Part-1.php

I´ve connected the signal "drag-data-received" for drag n DROP.

If i use the x and y variable in the callback to get the drag destination
row with $pathData = $widget->get_path_at_pos($x, $y); i got an wrong
position. Like kksou mentioned, i have to substract 1... that works... but
what, if i want to drag to the end of the list (last entry)? This isnt
working, because i substract 1 by default.

In the documentation i´ve found no hint for this.

	$treeView->connect('drag-data-received', array($this, 'onDrop'));

	public function onDrop($widget, $context, $x, $y, $data, $info, $time){
		
		# get the destination
		$pathData = $widget->get_path_at_pos($x, $y);
		
		$path = reset($pathData[0])-1;
		if($path < 1) $path = 0;

		# QUESTION - How to handle the drop on last entry?
		# i cannot access this, because i substract 1 by default!
		
		$selection->select_path($path);
		list($model, $iter) = $selection->get_selected();
		if ($iter === null) return false;
		$destCompoundId = $model->get_value($iter, 5);

		// aso......
		
	}

Best regards,
Andreas
-- 
View this message in context: http://www.nabble.com/drag-data-received---get_path_at_pos%28x%2Cy%29-wrong-result--tp16313683p16313683.html
Sent from the Php - GTK - Dev mailing list archive at Nabble.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.