- Online Community Forums » Allegro Development » File drag & drop concept

This thread is locked; no one can reply to it. rss feed Print
File drag & drop concept
Member #934
January 2001

Ok, I've been working on adding drag and drop to a display. After 3 days, I finally got allegro compiled to test. Currently, I am please at the progress, but I would like to change things a bit. Right now the drop copies files to a static string array and any new drops will overwrite the last. I would like to instead append to end some sort of dynamic list.

This is what I have now for an event. Technically it is a display event as you drop the files onto the display.

  int32_t x;
  int32_t y;
  int32_t count;
  const char **filenames;

1#ifndef __al_included_allegro5_dropfile_h 2#define __al_included_allegro5_dropfile_h 3 4#ifdef __cplusplus 5extern "C" { 6#endif 7 8AL_FUNC(bool, al_install_drag_drop, (ALLEGRO_DISPLAY *display)); 9AL_FUNC(void, al_uninstall_drag_drop, (void)); 10 11#ifdef __cplusplus 12 } 13#endif 14 15#endif

  bool processEvent(ALLEGRO_EVENT &event)
    switch (event.type)
      int32_t count = event.drop.count;
      const char **files = event.drop.filenames;

    } break;


Thoughts? Suggestions?

Trent Gamblin
Member #261
April 2000

Needs to be more generic. Drag and drop just about anything. And needs Mac and Linux support before considered seriously.

Mark Oates
Member #1,146
March 2001

Yea, what Trent said. That was my first thought, too.

The API should allow for any content type (or just supported content types) to be dropped, not just files.

Is allegro dev on GitHub? Where's the main development activity?

Visit <-- permanent coupon code ALLEGRO4LIFE for allegro users - use at checkout and get $3 off any order of 3 or more items! markdownAllegro logo

Thomas Fjellstrom
Member #476
June 2000

Is allegro dev on GitHub? Where's the main development activity?

there's a github mirror, but main repo is on sourceforge.

Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" --

Gideon Weems
Member #3,925
October 2003

DanielH is on fire. Rock on.

I see no need to go through the trouble of creating a dynamic list, if there's going to be a proper event. Users would handle such events as they see fit, right?

Member #934
January 2001

I did a simple search and how to add drag drop to a program was using WM_DROPFILES message. So, that's what I focused on.

Adding support for data is similar to clipboard access. Will have to look into that.

Go to: