wxDropFilesEvent(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸ’– wxDropFilesEvent πŸ’–

okay bestie sit down, we're talking about wxDropFilesEvent, which is an Erlang module definition in the wx manual (yep, the wxWidgets bindings, we love her). This is the class that handles drop files events β€” aka the moment when somebody drags files and just yeets them onto your window. 🌸


✨ NAME ✨

wxDropFilesEvent β€” this class is used for drop files events, i.e. when files have been dropped onto the window. it's giving "user has arrived with a folder full of stuff, deal with it". πŸ’…


🌈 DESCRIPTION 🌈

Real talk: the window has to have been enabled for dropping first, and you do that by calling wxWindow:dragAcceptFiles/2. no setup, no drop event, bestie. that's just how it is. 🫢

⚠️ IMPORTANT NOTE, DO NOT SKIP THIS ONE: this is a separate implementation from the more general drag and drop implementation documented in overview_dnd. This one uses the older, Windows message-based approach of dropping files. Two different systems, two different vibes, don't mix them up. 😭

go look at these too:

  • Overview events
  • wxWindow:dragAcceptFiles/2

this class is derived from, and can use functions from:

  • wxEvent

wxWidgets docs: wxDropFilesEvent


πŸ¦‹ Events πŸ¦‹

Use wxEvtHandler:connect/3 with wxDropFilesEventType to subscribe to events of this type. subscribe to the vibe, get the files. ⭐


πŸŽ€ DATA TYPES πŸŽ€

  • wxDropFiles() :: #wxDropFiles{}.
  • wxDropFilesEvent() :: wx:wx_object().
  • wxDropFilesEventType() :: drop_files.

look at that record syntax, she's iconic and she knows it. πŸ‘‘


πŸ’œ FUNCTIONS πŸ’œ

  • getFiles(This) -> [unicode:charlist()] when This :: wxDropFilesEvent().

Returns an array of filenames. πŸ“ the whole squad of them.

  • getNumberOfFiles(This) -> integer() when This :: wxDropFilesEvent().

Returns the number of files dropped. just the count, the headcount, the attendance sheet. πŸ”₯

  • getPosition(This) -> {X :: integer(), Y :: integer()} when This :: wxDropFilesEvent().

Returns the position at which the files were dropped. lowkey the who/what/where of the drop. πŸ“

Returns an array of filenames.

(yes, that last line is literally what the docs say, and yes, it's kind of a jump scare for a function called getPosition β€” but we report, we don't editorialize. πŸ™ˆ)


🌟 SEE ALSO / WRAP-UP 🌟

okay that's the whole thing, you ate it, periodt. ✨

this page came to you courtesy of Ericsson AB, and it's the wx 2.6 era of the manual β€” <rainbow>wxDropFilesEvent(3)</rainbow> β€” so go forth and handle those dropped files, main character. πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from