al_show_native_file_dialog(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’… al_show_native_file_dialog πŸ’…

okay bestie, welcome to the Allegro 5 reference manual, section 3alleg5 β€” today's main character is al_show_native_file_dialog, and she is literally the girl who pops up the file picker for you. let's get into it πŸŽ€


✨ NAME ✨

al_show_native_file_dialog β€” the Allegro 5 API function that serves the file dialog πŸ’…


🌸 SYNOPSIS 🌸

#include <allegro5/allegro_native_dialog.h>

bool al_show_native_file_dialog(ALLEGRO_DISPLAY *display,
   ALLEGRO_FILECHOOSER *dialog)

πŸ¦‹ DESCRIPTION πŸ¦‹

so the whole vibe here: this function shows the dialog window. periodt.

about that display argument β€” she's allowed to be NULL (no cap, it's fine), but if you do pass one, that display gets treated as the parent whenever that's possible. lowkey respectful of the hierarchy tbh πŸ‘‘

now the important part, and I need you to hear me on this: this function blocks the calling thread until it returns. like, it is not letting go. so if you don't wanna be stuck waiting around, you might wanna spawn a thread with al_create_thread(3alleg5) and call her from inside that thread instead. main character energy requires delegation πŸ’…

returns true on success, false on failure. that's it, that's the return value 🫢

Note: on Android, ALLEGRO_EVENT_DISPLAY_HALT_DRAWING(3alleg5) and ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING(3alleg5) need to be handled before this function returns. which means β€” and I cannot stress this enough β€” you must call it from a different thread. no exceptions, bestie 😭

and that's the whole page!! written up in the Allegro reference manual, mwah πŸ’– go forth and pick some files, you absolute icon βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from