Drag/drop cursors

Werner Lehmann lehmann at media-interactive.de
Tue May 14 05:58:26 PDT 2013


Pavel,

it seems as if e.g. the IDC_NODROP cursor is somewhat undocumented in 
Windows. I looked into the Delphi RTL source and they are using 32767 
for the lpCursorName parameter of LoadCursor. This and a few other 
constants are not documented on that MSDN page.

Anyway, I'd be ok with using platform DND. Even more so since this will 
eventually support a dragimage with FX8+. However, I am having 
difficulties capturing the drag events on target parents.

Consider this:
- drag source: a label L1
- drag target: a pane P with some children, e.g. a label L2

I want to handle the DND on the pane level, so I add event filters on 
pane P for MOUSE_DRAG_OVER and MOUSE_DRAG_ENTERED_TARGET. User starts 
DND on L1. In "L1.DRAG_DETECTED" a platform DND is started with 
startDragAndDrop. When dragging over P or L2, the event filters are not 
executed.

How can I handle the DND on the pane level? The other drag gestures 
allow event capturing here...

Werner

On 13.05.2013 17:08, Pavel Safrata wrote:
> Hi Werner,
> I'm sorry for the delay. You understand the gestures correctly. As I
> tried to explain earlier, the DnD cursors should not be used for non-DnD
> operation and it is not supported rather intentionally. It looks like
> some operating systems follow this reasoning as well. For instance, look
> at this page, it seems that on Windows we wouldn't have access to those
> cursors even if we wanted to provide them:
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms648391%28v=vs.85%29.aspx
>
> If you have something to copy/move/link, you may consider using DnD, it
> may not be that out of place. Note that it might fit best to pass
> references to the intra-app gesture which is unfortunately not supported
> yet ( https://javafx-jira.kenai.com/browse/RT-29082 ) but it can be
> easily worked around.
>
> Thanks,
> Pavel
>
> On 26.4.2013 11:29, Werner Lehmann wrote:
>> Hi Pavel,
>>
>> actually I would prefer the cursors to show automatically. According
>> to the MouseEvent JavaDoc there are 3 different drag/drop modes:
>>
>> 1. Simple press drag and release.
>> 2. Full press drag and release.
>> 3. Platform-supported drag-and-drop.
>>
>> I am using the 1st for node move/resize. Here I change the cursor to
>> one of the *_SIZE cursors. Cursor mapping is incorrect on Mac but that
>> is a known and Lombard-fixed bug - other than that it works fine.
>>
>> To drag a node from a toolbar into a workspace I would go with the 2nd
>> mode (startFullDrag in onDragDetected). This one does not change the
>> cursor automatically, and this is what I am asking about.
>>
>> The third mode does change the cursor but it seems a bit inappropriate
>> for node drags within the same scene.
>>
>> Maybe I am missing a step? The tutorial [1] is about platform
>> drag/drop only... Also, a drag-image would be nice but that seems to
>> exist for platfrom drag/drop only, in Lombard only (except for a
>> workaound like [2] which also does not solve the cursor
>> deny/copy/move/link problem).
>>
>> Rgds
>> Werner
>>
>> [1] http://docs.oracle.com/javafx/2/drag_drop/jfxpub-drag_drop.htm
>> [2]
>> http://stackoverflow.com/questions/13624491/implement-drag-and-drop-like-in-scene-builder
>>
>>
>>
>> On 25.04.2013 17:36, Pavel Safrata wrote:
>>> Hi Werner,
>>> the cursors you mention should appear automatically during drag-and-drop
>>> operation. I think they should not be used manually elsewhere because
>>> they are visually informing user about an ongoing drag-and-drop
>>> operation and using them at different times would be confusing. During a
>>> drag-and-drop operation the system is in a special mode with inner event
>>> loop, temporarily holding the dragged data, blocking many other
>>> features, and the well-known cursors make this clear to the user.
>>>
>>> If the cursors don't work for you during DnD, please file a bug. If you
>>> still think you need the cursors for your mouse events (which I tried to
>>> explain is a discouraged pattern), you can file feature request and see
>>> if it is approved (and even technically possible on all platforms).
>>>
>>> Thanks,
>>> Pavel
>>>
>>> On 25.4.2013 17:08, Werner Lehmann wrote:
>>>> Hi,
>>>>
>>>> I am missing typical cursors during drag/drop, e.g. a deny, add, move,
>>>> link cursor. Apparently those are not supported in
>>>> javafx.scene.Cursor. How would this be solved in a
>>>> platform-independent way?
>>>>
>>>> Best option currently seems to be: use the default cursor, and show
>>>> some tooltip/popup or unmanaged node below the cursor position to
>>>> indicate the drop effect to the user. Not really optimal...
>>>>
>>>> I could also use my own drag cursors but they would not fit into all
>>>> sets of cursors on the supported platforms. If there was at least a
>>>> way to get an image of the default cursor - then it could be
>>>> "enhanced" with a small overlay. But that does not seem feasible
>>>> either.
>>>>
>>>> Werner


More information about the openjfx-dev mailing list