SFML community forums

Help => General => Topic started by: DevilEdge on September 21, 2014, 04:37:45 am

Title: Is it possible to use Windows File Dialog Boxes/Menus with SFML?
Post by: DevilEdge 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
Title: Re: Is it possible to use Windows File Dialog Boxes/Menus with SFML?
Post by: Hapax 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 (http://sfml-dev.org/documentation/2.1/classsf_1_1Window.php#a26368e7162229f8637c34d80ab0f138e).
Title: Re: Is it possible to use Windows File Dialog Boxes/Menus with SFML?
Post by: eXpl0it3r 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.
Title: Re: Is it possible to use Windows File Dialog Boxes/Menus with SFML?
Post by: Hapax 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.