Re: Drag n Drop



thanx for reply.
But it seems that there is confusion, actually I want to set my cursor(mouse pointer) while dragging, and not drag_icon.
 

Paul Barton-Davis wrote:

a few days ago, this was posted to the gtk-list by
"Florent. Devin" <Florent Devin lifl fr>

----------------------------------------------------------------------
I found a solution, but I am not sure it is a good way to do that.
I use ctree but clist is the same.
I connect the event signal to the ctree
  gtk_signal_connect (GTK_OBJECT (ctree), "event", GTK_SIGNAL_FUNC
(ctree_event), NULL);
then in my callback I send the signal drag with this
  static gint where_press;
  if (GASPARD_VERY_CHAT) g_print ("Enter in ctree_event\n");
  switch (ev->type) {
    case GDK_BUTTON_PRESS : {
      switch (ev->button.button) {
        case 1 : {
          drag_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL,
                        gtk_widget_get_colormap (mainApp_Window),
                        &drag_mask, NULL, GASPARD_DRAG_ICON);
          gtk_drag_source_set (ctree, GDK_BUTTON1_MASK, target_slot, 1,
                               GDK_ACTION_COPY|GDK_ACTION_MOVE);
          gtk_drag_source_set_icon (ctree,
                                    gtk_widget_get_colormap
(mainApp_Window),
                                    drag_icon, drag_mask);
          gdk_pixmap_unref (drag_icon);
          gdk_pixmap_unref (drag_mask);
          gtk_signal_connect (GTK_OBJECT (ctree), "drag_data_get",
                              GTK_SIGNAL_FUNC (source_drag_data_get));
          gtk_signal_connect (GTK_OBJECT (ctree), "drag_data_delete",
                              GTK_SIGNAL_FUNC (source_drag_data_delete),
key);
          }
        }
      }
    }

And that is all I have to do. The advantage of this method is that you
can have a
different icon, for every different line in the clist
Hope this help
----------------------------------------------------------------------

BTW, please turn off the generation of HTML and the vcard nonsense in
your browser/email client. You doubled (or more) the size of your
email message with this nonsense.

-p

-- 
 
---------------------------------------------------------------------
        VIJAYKUMAR S. KALE
ESG, TTIL, Telco Campus,PUNE - 411 018
email:  vskale telco co in
phone:  (off.)  +91-212-7402049 (Direct)
                +91-212-7402947 (Direct)
        (resi.) +91-212-4358085
----------------------------------------------------------------------
~
 

Attachment: vsk.vcf
Description: Card for VijayaKumar S. Kale



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