On 10.09.2012 10:25, MacArthur, Ian (SELEX GALILEO, UK) wrote: > >> I have tried running a program on my WindowsXP,the events work!So,maybe >> the sentence is wrong.But I still need to point out that the events work >> do not means it can work anywhere inside the window,if there is a widget >> inside the window and you drag a file into it and then release the >> file,our window won't be able to receive event FL_DND_RELEASE(event >> FL_DND_ENTER and FL_DND_DRAG work as well as the former case),thus it >> cannot receive event FL_PASTE and the event data. >> Now,I am trying to find a way out to solve the problem,I think maybe we >> can make the widget send an event message to its parent window and then >> our window can process the event.That's my raw idea,I need more time to >> make an attempt.If anybody who knows how to solve the problem,please tell >> me,thanks. > > > To be honest, what I usually do in that situation is subclass a widget from > Fl_Box, that I set to have NO boxtype and no content (so is "invisible") and > then in its handle method I arrange for it to pass on all events except the > DnD ones... > > I then place this "over" the entire main window, and over all the other > widgets, and it handles all the drop events for everything. Other events pass > through normally. > > That appears to work and should alleviate the symptom you describe. > > I'm not at all sure why I do it this way, it seems to be a pattern of some > antiquity, so it may date back to a time when DnD didn't work so well and > this was the only way?
I thought of adding another comment to suggest this technique, but you beat me on it. AFAICT there are some pro's and con's to this scheme: pro: (1) you don't need to subclass any other widget to /deny/ DND, as I wrote in my previous post. (2) you don't need to subclass Fl_Window or Fl_Group, which might give you some headaches WRT normal/other event delivery con: (1) you circumvent /all/ DND event delivery for text widgets, i.e. you can't drag text to /any/ widget "below" your DND box, unless you propagate the FL_PASTE event or maybe others as well selectively. --- This would of course be the same effect, if you subclassed all other widgets to deny DND events, but you could do this more selectively. OTOH, combining both ways by adding one ore more DND boxes only on "DND sensitive" areas could be a sensible way to solve the issue. Albrecht _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

