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



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!!

<SNIP>
--------------------------------------
$tree->drag_source_set('button1_mask', ['copy',
'move'],{target=>'STRING', flags=>0, info=>0});

$tree->signal_connect('drag_data_get',sub{
        my ($w,$context, $data, $info, $time) = @_;
        my $text = $items[1]->widget->get();
        $data->set($data->target, 8,"my-special-drag-info" );
        return 1;
        });




$clist->drag_dest_set('all', ['copy', 'move'],{'target' => "STRING",
'flags' => 0, 'info' => 0});

$clist->signal_connect('drag_data_received',sub{
        my ($w, $tree, $context, $time, $info, $data) = @_;
        my $data = $data->get();

        "do something with the data"

        );
--------------------------------------
<SNIP>

On Thu, 2002-03-28 at 22:11, Derek Wueppelmann wrote:
On Wed, 2002-03-20 at 15:15, Gavin Jefferies wrote:

I had this problem as well. I hacked arround it by always setting the
row height when creating the list and subtracting by this known when
figuring out the drop row/col. i.e.

I've been watching this thread intently .. Although a bit behind. I was
hoping that this would help me in getting drag and drop working in my
application. However I don't even know where to begin. Any of the
tutorials I've found all have this section omited. Can you or anybody
else point me to a good location for how to get Drag and Drop working.

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

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
-- 
Mvh

Johan Ankarloo
Volvo IT
Network & Security Engineer
Tel: +46 31 32 128 18

====================================================================
This message may contain confidential and/or proprietary information,
and is intended only for the person/entity to whom it was originally
addressed. The content of this message may contain private views and
opinions which do not constitute a formal disclosure or commitment
unless specifically stated.




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