[Gambas-user] Problems with some events
Benoit Minisini
gambas at ...1...
Thu Nov 1 21:22:48 CET 2007
On mercredi 31 octobre 2007, José Luis Redrejo wrote:
>
> So, how could I get the information of a dropped file over a FileView
> control?
> That's a very typical use of a "FileView" in an application: dragging and
> dropping files from Nautilus o Konqueror to add files to a directory.
>
> Now it's possible to do it with gtk, but reading your answer I guess you're
> going to modify it to behave as in qt, where these events can not be
> reached.
>
> Regards.
You must add this feature directly to the FileView control, by modifying its
source code.
Or you can inherits FileView, try to find its child IconView / ListView (not
too difficult, use FileView.Children[0]) , and use the Observer class to
catch Drag & Drop events sent to them.
--8<-----------------------------------------------------------------
'CLASS MyFileView
INHERITS FileView
PRIVATE $hObserver AS Observer
PUBLIC SUB _new()
$hObserver = NEW Observer(ME.Children[0]) AS "TheIconView"
END
PUBLIC SUB TheIconView_Drop()
PRINT Drag.Data
END
--8<-----------------------------------------------------------------
You have more work if you want to now which icon was specifically hit by the
drop.
Note that at the moment, gb.gtk IconView cannot returns the needed (X,Y,W,H)
coordinates of an icon. I didn't find how to do that in GTK+, whereas the API
allows that for TreeView items.
Regards,
--
Benoit Minisini
More information about the User
mailing list