FLTK logo

How to enable Drag n Drop on OpenGL window ?

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.opengl  ]
 
Previous Message ]New Message | Reply ]Next Message ]

How to enable Drag n Drop on OpenGL window ? Furqan Feb 17, 2013  
 
My application is OpenGL based. I have created an OpenGL windows inside of Fl_Double_Window.

Now here is the simple code for drag n drop, copied from an example.

// SIMPLE RECEIVER CLASS
class Receiver : public Fl_Box {
public:
	// Ctor
	Receiver(int x,int y,int w,int h) : Fl_Box(x,y,w,h) {
		box(FL_FLAT_BOX); color(10); label("..to\nhere");
	}
	// Receiver event handler
	int handle(int event) {
		int ret = Fl_Box::handle(event);
		switch ( event ) {
		case FL_DND_ENTER: // return(1) for these events to 'accept' dnd
		case FL_DND_DRAG:
		case FL_DND_RELEASE:
			ret = 1;
			break;
		case FL_PASTE: // handle actual drop (paste) operation
			label(Fl::event_text());
			fprintf(stderr, "Pasted '%s'\n", Fl::event_text());
			ret = 1;
			break;
		}
		return(ret);
	}
};

In my application I code like this..

MainWindow = new Fl_Double_Window(WINDOW_SIZE_W, WINDOW_SIZE_H, "");

Receiver box(0,0,WINDOW_SIZE_W, WINDOW_SIZE_H);

MainWindow->end();
MainWindow->show(argc, argv);

Now the issue is, when I drag n drop one file over the OpenGL screen it doesn't accept the file. File only accepted if I drop on the "Receiver box". But my application screen is totally covered with the OpenGL screen, so, how can I enable Drag n Drop on the OpenGL screen ?

Any idea ?

thanks.
furqan
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.