Nana C++ Library  

An open-source C++ framework project
The Programmer's Guide 
nana::gui::filebox

Description

Create an Open or Save dialog box to let user select the name of a file.

Model of

None

Public base classes

None

Members

filebox(window owner, bool for_open) The construction.
~filebox() The destruction.
void title(const nana::string& s) Sets the title of filebox, the title defaultly is "Open" or "Save As".
void init_path(const nana::string&) Sets the suggestion init path. The init path is used to locate a directory when the filebox starts.
void init_file(const nana::string&) Sets a init file, if it contains a path, the init path is replaced by the path of init file.
void add_filter(const nana::string& description, const nana::string& filetype) Add a filetype filter, the first parameter is a description of filter(for example. "Text File"), the second parameter specifies the filter pattern(for example, "*.TXT"). To specify multiple filter in a single description, use a semicolon to separate the patterns(for example,"*.TXT;*.DOC;*.BAK").
nana::string file() const Returns the selected file path.
bool operator()() const Calls the filebox.

File

nana/gui/filebox.hpp

Notes

1, An example of filebox

#include <nana/gui/wvl.hpp>
#include <nana/gui/filebox.hpp>

int main()
{
    using namespace nana::gui;
    filebox fb(0, true);
    fb.add_filter(STR("Text File"), STR("*.text;*.doc"));
    fb.add_filter(STR("All Files"), STR("*.*"));
    if(fb())
    {
        nana::string file = fb.file();
    }
}


See also

None.


Move to The Nana Programmer's Guide Main Page