Re: Drag and drop from Gtk::Tree to Gtk::CList



On Tue, 2002-04-02 at 02:08, Johan Ankarloo wrote:
I will try to explain how this work.

1. Set the drag_source_set. This initializes what will trigger the drag.
This is done on the source side.
2. Set the drag_dest_set. This trigger what type of drag source that is
allowed. Should match the drag_source_set
3. Connect a 'drag_data_get' signal on the source. Set some data that
you want to transfer to the other side.
4. Connect a 'drag_data_received' on the dest side. Collect the data and
do something useful with it. Remember that if you don't set any data you
wont receive any data!!

Thanks alot. This has worked really well except for one small problem.
Instead of using the tree to recieve the received command I've set it up
so tree items can receive this signal. However only the root TreeItem
actually works all the others seem not to at all. I'm using the same
code to do both, is there a particular order in which this must be done?
Or can you only set this up before the window is displayed?

Here is what I do in my expand routine, that should add the recieve
method to all my TreeItems.

$newItem = new_with_label Gtk::TreeItem($value);
$subTree->append($newItem);
$newItem->signal_connect('select', \&treeItemSelected, $value);
$newItem->signal_connect('button_press_event', \&treeButtonPressed);
$newItem->drag_dest_set('all', ['copy', 'move'],
        {target=>'STRING', flags=>0, info=>0});
$newItem->signal_connect('drag_data_received', \&recieveDragData);
$newItem->set_user_data($value);
$newItem->show();

This exact same code works to setup the initial root TreeItem.

-- 
 o)    Derek Wueppelmann               (o
(D .    monkey monkey homeip net        D).
((`      http://monkey.homeip.net/     ( ) `




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