#include <ROOT/RFileDialog.hxx>
void filedialog(int kind = 0)
{
std::string fileName;
switch (kind) {
case 1: fileName = RFileDialog::OpenFile("OpenFile title"); break;
case 2: fileName = RFileDialog::SaveAs("SaveAs title", "newfile.xml"); break;
case 3: fileName = RFileDialog::NewFile("NewFile title", "test.txt"); break;
}
if (kind > 0) {
printf("Selected file: %s\n", fileName.c_str());
return;
}
auto dialog = std::make_shared<RFileDialog>(RFileDialog::kOpenFile, "OpenFile dialog in async mode");
dialog->SetNameFilters({ "C++ files (*.cxx *.cpp *.c *.C)", "ROOT files (*.root)", "Image files (*.png *.jpg *.jpeg)", "Text files (*.txt)", "Any files (*)" });
dialog->SetSelectedFilter("ROOT files");
dialog->SetCallback([dialog](const std::string &res) mutable {
printf("Selected file: %s\n", res.c_str());
});
dialog->Show();
}
#define R__LOAD_LIBRARY(LIBRARY)
- Date
- 2019-11-01
- Warning
- This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
- Author
- Sergey Linev S.Lin.nosp@m.ev@g.nosp@m.si.de
Definition in file filedialog.cxx.