Table of Contents

msg_password

`msg_password()` creates a password OK/Cancel dialog object.

Use it when the user must enter a password or other hidden text.

Constructor

msg_password()

Creates a password dialog.

dlg = msg_password();

Properties

Property Type Description
`title` string Dialog title.
`message` string Dialog message text.
`buttons` boolean Whether dialog buttons are shown.
`password_label` string Label shown next to the password field.
`password` string Initial password before showing; result password after the dialog returns.
`has_result` boolean `true` after the dialog has produced a result.
`action` string Result action: `ok`, `cancel`, or `none`.
`ok` boolean `true` when OK was selected.
`cancel` boolean `true` when Cancel was selected.
`save` boolean Save flag in result map. Usually `false` for `msg_password`.

Methods

Method Returns Description
`title(text)` self Sets the dialog title.
`message(text)` self Sets the dialog message.
`buttons(enabled)` self Shows or hides dialog buttons.
`password_label(text)` self Sets password field label.
`password(text)` self Sets initial password text.
`on_result(callback)` self Sets asynchronous result callback.
`show()` map or self Shows the dialog. Returns result map unless `on_result()` is used.
`click_ok()` boolean Clicks OK on an active asynchronous dialog.
`click_close()` boolean Clicks Close on an active asynchronous dialog.

Example

result = msg_password()
    .title("Password")
    .message("Enter password")
    .password_label("Password:")
    .show();
 
if (result.ok)
{
    print(result.password);
}

Previous: msg_yes_no

Next: GUI objects