Hi everyone!
I've been trying to get drag and drop to work in my application, but without
success.
I've been looking at the two articles I found here (770 and 771) and made a
similar class of my own:
#pragma once
#include "fltk/InvisibleBox.h"
#include "fltk/events.h"
#include <string>
#include <iostream>
namespace fltk
{
class TvsDnDBox : public fltk::InvisibleBox
{
public:
TvsDnDBox(int x, int y, int w, int h, const char *l = 0) :
fltk::InvisibleBox(x, y, w, h, l)
{
lastEvent = fltk::NO_EVENT;
eventFile = "";
}
int handle(int event)
{
switch(event)
{
case fltk::DND_ENTER:
case fltk::DND_RELEASE:
case fltk::DND_LEAVE:
case fltk::DND_DRAG:
lastEvent = event;
return 1;
case fltk::PASTE:
lastEvent = event;
eventFile = fltk::event_text();
do_callback();
return 1;
}
return fltk::InvisibleBox::handle(event);
}
const char* file()
{
return eventFile.c_str();
}
private:
int lastEvent;
std::string eventFile;
};
};
I've placed this box onto the window (covering the whole surface) but I'm still
not able to drag and drop files onto the window.
Anyone have any idea why this isn't working?
Thanks!
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk