Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Is it possible to use Windows File Dialog Boxes/Menus with SFML?  (Read 3068 times)

0 Members and 1 Guest are viewing this topic.

DevilEdge

  • Newbie
  • *
  • Posts: 28
    • View Profile
Is it possible to use Windows File Dialog Boxes/Menus with SFML?
« on: September 21, 2014, 04:37:45 am »
Hi there,

For the program that I've been working on, I need the user to be able to traverse through the system's filesystem to find image files to be used by the program. In Windows API there's functions for this, and is it possible to use it with SFML windows? If not, what other options could I look at?

Thanks

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Is it possible to use Windows File Dialog Boxes/Menus with SFML?
« Reply #1 on: September 21, 2014, 06:41:52 am »
No, SFML doesn't provide access to OS-specific functions. This includes file systems and menus. The features have been discussed about including cross-platform version for SFML 3 but until then, you may have to use another library for those features (or write your own code to access them).
You can access a SFML window's handle to perform OS-specific operations on the window. This doesn't help with menus, however, as the events themselves are swallowed and lost by SFML.
SFML window handle.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Is it possible to use Windows File Dialog Boxes/Menus with SFML?
« Reply #2 on: September 21, 2014, 08:26:10 pm »
What Hapax said is not entirely true for the asked question.

SFML doesn't provide such facilities, but you can still use the OS specific functions. On Windows these are simple WinAPI calls, which IIRC don't depend on your window and if they do, you can get the handle as Hapax has linked.
However if you want to go cross-platform, I'm not sure if all the OS provide such functions in an easy way.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Is it possible to use Windows File Dialog Boxes/Menus with SFML?
« Reply #3 on: September 22, 2014, 12:09:41 am »
What Hapax said is not entirely true for the asked question.
Me, wrong? Never! /sarcasm

I was trying to say that SFML doesn't provide its own way of accessing, not that it doesn't provide access at all. The way I worded it could suggest that SFML blocks connection to the OS but it does not.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything