ofDocsdocumentation utils ofSystemUtils (functions)

ofSystemUtils (functions)


ofSystemAlertDialog( ... )

void ofSystemAlertDialog(string errorMessage)

show an error message in an alert dialog box


ofSystemLoadDialog( ... )

ofFileDialogResult ofSystemLoadDialog(string windowTitle, bool bFolderSelection=false, string defaultPath)

show a file load dialog box

Parameters:

windowTitle optional window title string, ie. "Load background image"

bFolderSelection set to true to allow folder selection

defaultPath optional default directory path to start the dialog in, ie. ofFilePath::getUserHomeDir() \return dialog result with selection (if any)

ofFileDialogResult result = ofSystemLoadDialog("Load file");
if(result.bSuccess) {
  string path = result.getPath();
  // load your file at `path`
}

See also: ofFileDialogResult.


ofSystemSaveDialog( ... )

ofFileDialogResult ofSystemSaveDialog(string defaultName, string messageName)

show a file save dialog box

Parameters:

defaultName suggested filename to start dialog, ie "screenshot.png"

messageName descriptive text for the save action, ie. "Saving screenshot as" \return dialog result with selection (if any)

ofFileDialogResult result = ofSystemSaveDialog("default.jpg", "Save");
if(result.bSuccess) {
  string path = result.getPath();
  // save your file to `path`
}

See also: ofFileDialogResult.


ofSystemTextBoxDialog( ... )

string ofSystemTextBoxDialog(string question, string text)

show a text entry dialog box

Parameters:

question descriptive text for the text entry, ie. "What's your favorite color?"

text optional default text entry string, ie. "blue"