GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Aug 28, 2014 9:05 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Iconview drag item and see a border over dest Gtk+3 Py3.2
PostPosted: Thu Mar 01, 2012 12:53 pm 
Offline
Familiar Face

Joined: Sat Feb 04, 2012 12:41 pm
Posts: 10
Sorry for my poor English...

What I want is that when I drag an item, from one iconview to another, then before I release it I want to see where it will be dropped.
If I hold it over an item when dragging, that item must have a border and if I hold it between two items, I want a line. This is so that I can see where it will be inserted in the ListStore.

The insertion in the liststore have I solved. I just want it to be clear for the user where the item will be dropped.

I think this is default in a gtk2 iconview.

Please point me in the right direction. I have tried with CSS but with no luck.

EDIT:
If you have a solution in C it might help, though I'm not a C programmer.


Top
 Profile  
 
 Post subject: Re: Iconview drag item and see a border over dest Gtk+3 Py3.
PostPosted: Tue Mar 06, 2012 6:16 pm 
Offline
Familiar Face

Joined: Sat Feb 04, 2012 12:41 pm
Posts: 10
Here I can find out where to draw a line, above or below the item.

But I don't know how to draw the line and I'm having some trouble with how to get the exact position of the line. It must be under the pisxbuf and the string with it's name.

Can someone show me how to draw the line please?

Code:
 
# day1 is an iconview 
self.day1.connect("drag-motion",self.day1.on_drag_move)

def on_drag_move(self, widget, drag_context, x, y, time):
        position = None
        try:
            path, position = widget.get_dest_item_at_pos(x, y)
            model = widget.get_model()
            selected_iter = model.get_iter(path)
            pixbuf = model.get_value(selected_iter, COLUMN_PIXBUF)
            name = model.get_value(selected_iter, COLUMN_TEXT_NAME)
        except:
            print("no item")

        if position != None:
            print("item at Path: ",path,"position: ", position)
            print(("mouse_pos_X",x ,"mouse_pos_Y", y))

            if (position == Gtk.IconViewDropPosition.DROP_LEFT or position == Gtk.IconViewDropPosition.DROP_ABOVE or position == Gtk.IconViewDropPosition.DROP_INTO):
                print("Pixbuf width", pixbuf.get_width())
                print("position LEFT/ABOVE")

            elif (position == Gtk.IconViewDropPosition.DROP_RIGHT or position == Gtk.IconViewDropPosition.DROP_BELOW):
                print("Pixbuf width", pixbuf.get_width())
                print("position RIGHT/BELOW")
        else:
            print("position = None")


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] 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