GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sat Nov 28, 2015 2:52 pm

All times are UTC

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Drag and drop on rows in treeview - highlighting
PostPosted: Thu Jul 24, 2014 2:05 pm 
Familiar Face

Joined: Wed Apr 20, 2011 10:00 am
Posts: 10
So I started to playing around with GTK Drag and drop, read couple of articles and managed to get what I wanted - path to dragged file/directory when dropping it on rows of treeview but I can't seem to get to highlight row that mouse pointer is above.

I used:

gtk_drag_dest_set(users_view,(GtkDestDefaults)(GTK_DEST_DEFAULT_ALL | GTK_DEST_DEFAULT_HIGHLIGHT),typ_drag,1, GDK_ACTION_COPY);


(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
        GtkSelectionData *selection_data, guint target_type, guint time,
        gpointer data)
   gchar** names;
   gchar* name;


        /* Deal with what we are given from source */
        if((selection_data != NULL) && (gtk_selection_data_get_length(selection_data) >= 0))

                /* Check that we got the format we can use */
                switch (target_type)
            case 1:
                  names = gtk_selection_data_get_uris(selection_data);
                  name = g_filename_from_uri(names[0],NULL,NULL);
                  std::cout << name << std::endl;

                                g_print("Something else");


        gtk_drag_finish (context, TRUE,FALSE, time);

EDIT: Now I see the problem, usually You should use drag-motion signal and then highlight widget with highlight drag function but because I use GTK_DEST_DEFAULT_ALL GTK autmatically sets all drag and drops events and therfore drag-motion is never called in my code.

Is there a soultion to fix it without writting whole DnD by myself?

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 4 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group