On 02.05.2016 07:28 Rob McDonald wrote:
>
> I have derived a class from Fl_Group that can receive drag-n-drop payloads.
>
> Inside that group, among other widgets, I have an Fl_Output.
>
> On OSX, the Fl_Output widget sometimes intercepts the drop payload,
> causes the computer to beep, and sometimes prevents the payload from
> being delivered to the group. Other times, it passes on through fine.
That sounds like a bug in the OS X implementation.
> On other platforms, it doesn't seem to do this.
Thanks for this additional verification. The behavior should always be
as close as possible on all platforms, except if the platform "dictates"
another behavior.
Let's wait a while and see if Manolo has an idea/solution for this. If
not, you should file a bug report, preferable with a working small test
program so that we can see and fix the wrong behavior. If you can
provide such a demo program, please feel free to post it here as an
attachment. Don't forget to describe the test scenario to use to see the
bug and, if necessary, the expected (desired) behavior.
> Similarly, in another portion of my program, I have an Fl_Input that
> similarly intercepts the dropped payload. On OSX, it always prevents
> the payload from being delivered. On Windows, the payload string
> briefly appears in the Fl_Input box until my program refreshes it.
Hmm, I don't understand "until my program refreshes it". What does your
program do to refresh it?
> The payload is then successfully delivered.
That's good. Anyway, a short, complete, compileable test/demo program
would be interesting to see as well.
> Is there a way to disable Fl_Input and Fl_Output receipt of dropped
> payloads without deriving a new class?
I'm not aware of one.
> Or, if that is the best way, what do you suggest?
Are you asking what to do to prevent DND in a derived class? If yes,
take a look at the FL_DND_* events and their descriptions.
http://www.fltk.org/doc-1.3/events.html#events_dnd
(FL_DND_ENTER:)
"A widget that is interested in receiving drag'n'drop data must return 1
to receive FL_DND_DRAG, FL_DND_LEAVE and FL_DND_RELEASE events."
So if you explicitly return 0 on FL_DND_ENTER events this should suffice.
BTW: There's an interesting sentence in the description: "FL_DND_*
events cannot be used in widgets derived from Fl_Group or Fl_Window."
I'm not sure what this actually means, i.e. if this is true for all
platforms, or if it is no longer true in current FLTK. I have no idea
what the reason for this sentence is (was). You seem to do just that in
your application, so I can't say if this is a "supported usage".