NvDialog 0.10.1
A cross-platform modal dialogs library for C/C++ that uses the native OS theme.
Loading...
Searching...
No Matches
nvdialog_input_box.h File Reference

Go to the source code of this file.

Typedefs

typedef struct _NvdInputBox NvdInputBox
 A simple input box that accepts text input from the user.

Functions

NVD_API NvdInputBoxnvd_input_box_new (const char *title, const char *msg)
 Constructs a new NvdInputBox and returns it.
NVD_API void nvd_show_input_box (NvdInputBox *box)
 Displays the NvdInputBox given to the user.
NVD_API NvdDynamicStringnvd_input_box_get_string (NvdInputBox *box)
 Retrieves the text entered by the user in an NvdInputBox.

Typedef Documentation

◆ NvdInputBox

typedef struct _NvdInputBox NvdInputBox

A simple input box that accepts text input from the user.

An NvdInputBox provides the user with a small prompt (commonly a dialog window similar) to NvdDialogBox that requests some text input from the user. When the input is submitted, the library returns the submitted text. For convenience and compatibility reasons, the input is guaranteed to be limited to a single line.

Note
Just like NvdDialogBox and some other APIs, reusing an NvdInputBox is undefined behaviour, depending on the platform.
See also
NvdDialogBox
Since
v0.10.0

Function Documentation

◆ nvd_input_box_get_string()

NVD_API NvdDynamicString * nvd_input_box_get_string ( NvdInputBox * box)

Retrieves the text entered by the user in an NvdInputBox.

Parameters
boxThe input box to get the string from. May not be NULL.
Returns
A constant pointer to an NvdDynamicString containing the user's input.
Note
Invalid data may be given by the user. Make sure you check the string for validity.
Since
v0.10.0

◆ nvd_input_box_new()

NVD_API NvdInputBox * nvd_input_box_new ( const char * title,
const char * msg )

Constructs a new NvdInputBox and returns it.

Parameters
titleThe title of the input box, cannot be NULL
msgThe message of the input box. If NULL, then a preconfigured string will be displayed.
Since
v0.10.0
Warning
By default on Windows the dialog will use a fallback theme, since NvDialog does not want to force a manifest to load the proper theme as required by WinAPI. This may make controls look a bit outdated. To fix it, you must either supply your own .rc file and change the theming manually, or embed, at your own risk of breaking other libraries, the .rc file directly into NvDialog. If you do the former, do it before initializing the library. This does not apply on macOS and Linux.
Returns
A new NvdInputBox on success, NULL otherwise.

◆ nvd_show_input_box()

NVD_API void nvd_show_input_box ( NvdInputBox * box)

Displays the NvdInputBox given to the user.

Parameters
boxThe input box to display. May not be NULL.
Note
To retrieve the input of the user, use nvd_input_box_get_string.
Since
v0.10.0