Hi All!
Does anyone have an example DRAG&DROP files in to program? Only interested in examples of using GTK. Please do not send me to the GNOME documentation, I'm there to death will try a bunch of stuff. If there is an example and do not feel sorry to lay out, be kind. If there is an example on C \ C ++, it will also сome in handy.
GTK Example Drag&DROP files in the window?
Re: GTK Example Drag&DROP files in the window?
You could try to find a C example via Google.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: GTK Example Drag&DROP files in the window?
No comment ;-)
Code: Select all
#include once "fltk-c.bi"
function HandleCB cdecl (byval self as any ptr,byval event as FL_EVENT) as long
static as integer ActiveDND=0
select case as const event
case FL_EVENT_DND_ENTER : ActiveDND=1 : return 1
case FL_EVENT_DND_LEAVE : ActiveDND=0 : return 1
case FL_EVENT_DND_DRAG , FL_EVENT_DND_RELEASE : return 1
case FL_EVENT_PASTE
if ActiveDND then
beep
print *Fl_EventText() : ActiveDND=0 : return 1
end if
end select
return Fl_WindowExHandleBase(self,event)
end function
'
' main
'
var win = Fl_WindowExNew(640,480,"Drag file[s] over the window !")
Fl_WindowExSetHandleCB win,@HandleCB
Fl_WindowShow win
Fl_Run
Re: GTK Example Drag&DROP files in the window?
The OP said GTK.D.J.Peters wrote:No comment ;-)Code: Select all
#include once "fltk-c.bi" function HandleCB cdecl (byval self as any ptr,byval event as FL_EVENT) as long static as integer ActiveDND=0 select case as const event case FL_EVENT_DND_ENTER : ActiveDND=1 : return 1 case FL_EVENT_DND_LEAVE : ActiveDND=0 : return 1 case FL_EVENT_DND_DRAG , FL_EVENT_DND_RELEASE : return 1 case FL_EVENT_PASTE if ActiveDND then beep print *Fl_EventText() : ActiveDND=0 : return 1 end if end select return Fl_WindowExHandleBase(self,event) end function ' ' main ' var win = Fl_WindowExNew(640,480,"Drag file[s] over the window !") Fl_WindowExSetHandleCB win,@HandleCB Fl_WindowShow win Fl_Run
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: GTK Example Drag&DROP files in the window?
I know but I show him how easy FLTK-c can be ;-)Munair wrote:The OP said GTK.
every FLTK widget can receive files via drag and drop.
every FLTK widget can use the clipboard
every FLTK widget can use the printer
every FLTK widget can ...
Joshy
Re: GTK Example Drag&DROP files in the window?
While developing a GTK interface, I found some positive reviews here regarding FLTK which got me curious. So I tried to install it. But I cannot get it to work. See this thread: viewtopic.php?f=14&p=239001#p239001
Re: GTK Example Drag&DROP files in the window?
I posted an example years ago here:VANYA wrote:Hi All!
Does anyone have an example DRAG&DROP files in to program? Only interested in examples of using GTK. Please do not send me to the GNOME documentation, I'm there to death will try a bunch of stuff. If there is an example and do not feel sorry to lay out, be kind. If there is an example on C \ C ++, it will also сome in handy.
Drag & Drop
Minor adaptations to the target_list should make it work with files as well.