Common dialogs
This page has been automatically translated using the Google Translate API services. We are working on improving texts. Thank you for your understanding and patience.
Functions
const char_t* | comwin_open_file (...) |
const char_t* | comwin_save_file (...) |
void | comwin_color (...) |
Common dialogs are default windows provided by the operating system to perform daily tasks such as: Open files (Figure 1), select colors, fonts, etc. Its use is doubly beneficial. On the one hand we avoid programming them as part of the application and, on the other, we take advantage of the user's previous knowledge since they will surely have been used in other programs.
comwin_open_file ()
Launch the open file dialog.
const char_t* comwin_open_file(Window *parent, const char_t **ftypes, const uint32_t size, const char_t *start_dir);
parent | Parent window. |
ftypes | File types for the filter. |
size | Number of file types. |
start_dir | Start directory of the dialog. It can be |
Return
The name of the selected file or NULL
if the user has aborted the dialog.
Remarks
It will be launched in modal. parent
will remain locked until the dialog is accepted.
comwin_save_file ()
Launch the save file dialog.
const char_t* comwin_save_file(Window *parent, const char_t **ftypes, const uint32_t size, const char_t *start_dir);
parent | Parent window. |
ftypes | File types for the filter. |
size | Number of file types. |
start_dir | Start directory of the dialog. It can be |
Return
The name of the selected file or NULL
if the user has aborted the dialog.
Remarks
It will be launched modal. parent
will remain locked until the dialog is accepted.
comwin_color ()
Launch the color selection dialog.
void comwin_color(Window *parent, const real32_t x, const real32_t y, const align_t halign, const align_t valign, const color_t current, color_t *colors, const uint32_t n, Listener *OnChange);
1 2 3 4 5 6 7 8 |
static void i_OnColorChange(App *app, Event *e) { color_t *color = event_params(e, color_t); // Do something ... } comwin_color(window, "Select color", 100, 50, ekRIGHT, ekTOP, kCOLOR_BLUE, NULL, 0, listener(app, i_OnColorChange, App)); |
parent | Parent window. |
x | Initial x position. |
y | Initial y position. |
halign | Horizontal alignment with respect to |
valign | Vertical alignment with respect to |
current | Current color the panel will display. |
colors | Custom colors that the panel will show and that can also be edited. It can be |
n | Number of custom colors. |
OnChange | Callback function to be called after each color change. |
Remarks
On Windows and Linux systems the dialog will be launched modally and must be accepted for a color change notification to occur via OnChange
. On macOS, notifications will be launched continuously as the dialog is manipulated.