RE: [fltk.general] [FLTK 1.3.5] Making a draggable item - [General Use]

18 views
Skip to first unread message

MacArthur, Ian (Leonardo, UK)

unread,
Sep 10, 2020, 6:32:48 AM9/10/20
to fltkg...@googlegroups.com

> I want to make an item draggable between windows.
> What I am trying to make is to be able to click&drag an item from one
> window/TL_Window to another.

Is this not just drag-and-drop you are describing? FLTK already supports drag-and-drop, there are examples in the test folder.

Or is it something else?

Maybe I have not understood your description properly.





Leonardo MW Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

Catalin Poida

unread,
Sep 10, 2020, 7:53:23 AM9/10/20
to fltk.general
I've saw the example with the drag and drop, but there was bo visual display of the item drag and dropped. There was only the technical part that send text data from one window to another.

I want to creat a visual experience as well, similar to how you drag and drop files in file explorer.

imm

unread,
Sep 10, 2020, 9:26:47 AM9/10/20
to general fltk
On Thu, 10 Sep 2020, 12:53 Catalin Poida wrote:
I've saw the example with the drag and drop, but there was bo visual display of the item drag and dropped. There was only the technical part that send text data from one window to another.

I want to creat a visual experience as well, similar to how you drag and drop files in file explorer.

Recent versions of fltk can drag/drop a variety of formats (e.g. PNG) not just text. But you may need to compile with the later ABI to get that (which is not the default for 1.3)

I don't remember what ABI that was added at though - might only be 1.4.?

That said, you still don't get much visual feedback, so to get that you possibly need to do that yourself.

In essence you need a small bordeless window to show the payload in, and make that track the mouse motion during the drag operation.

When the drag stops (i.e. the button is released) you hide that window and enact the drop target action in the usual way.

It's a bit of a hassle, but...

TBH, I don't much care for that effect anyway (I guess I'm too old!) but it does seem popular in a lot of apps now.
-- 
Ian
From my Fairphone FP3

Catalin Poida

unread,
Sep 12, 2020, 5:28:24 AM9/12/20
to fltk.general
I saw in fltk 1.3.5  :
=================
#if !(defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN))
  static void copy_image(const unsigned char* data, int W, int H, int destination = 0); // platform dependent
#endif
========================

Yeah, it's nice to be able to copy the image to clipboard, but yeah, creating a visual effect/feedback for the user it's also important.

Regarding how it should work. In theory, I understand what needs to be done, but the practical stuff kills me (the part where I need to shape the window exactly as the PNG image).
Reply all
Reply to author
Forward
0 new messages