Sidebar

Home



Expressions V4


Tutorials

How-To

Reference

  Lexical basics
  Type system
  Variables and assignment
  Operators
  Expression rules
  Control flow
  Functions
  Built-in functions
   None and NaN
   Arithmetic
   Algebra
   Logarithmic and Exponential
   Trigonometric
   Rounding and Centering
   Strings
   Output, Formatting, and Errors
   Dialogs, Clipboard, Platform, and Paths
  Methods and properties
  Built-in methods
   Common Value Methods
   Number Methods
   String Basic Methods
   String Slice Methods
   String Parsing Methods
   String Formatting Methods
   String Regex Methods
   String Trim and Case Methods
  Objects
  Built-in objects
   Collections
    array
    map
    data_array
   Image data
   Image stream
   Dialogs
    file_open
    file_save
    msgok
    msgokcancel
    msgyesno
    msgpassword
   GUI objects
    window
    panel
    group
    splitpanel
    label
    textbutton
    drawablebutton
    togglebutton
    togglegroup
    textinput
    textedit
    numinput
    slider
    combobox
    listbox
    progressbar
    led
    separator
    menu
    image
    snake
  Classes and user-defined objects
  Include system
  Error model
  Execution model and sessions
  Host integration
  Limits and performance
  Formal reference
  Glossary

Cookbook

exprv4:reference:objects:dialog_msgok

msgok

`msgok()` creates an OK message dialog object.

Use it for information messages where the user only acknowledges the message.

Constructor

msgok()

Creates an OK message dialog.

dlg = msgok();

Properties

Property Type Description
`title` string Dialog title.
`message` string Dialog message text.
`buttons` boolean Whether dialog buttons are shown.
`has_result` boolean `true` after the dialog has produced a result.
`action` string Result action: `ok`, `cancel`, or `none`.
`ok` boolean `true` when the result action is OK.
`cancel` boolean `true` when the result action is Cancel.
`save` boolean Save flag in result map. Usually `false` for `msgok`.

Methods

title(text)

Sets the dialog title and returns the dialog object.

dlg = msgok().title("Information");

message(text)

Sets the message text and returns the dialog object.

dlg = msgok().message("Operation finished.");

buttons(enabled)

Shows or hides dialog buttons and returns the dialog object.

dlg = msgok().buttons(true);

on_result(callback)

Sets a callback for asynchronous result handling. The callback receives one argument: a `map` result.

When `on_result()` is used, `show()` displays the dialog and returns the dialog object immediately.

function done(result)
{
    if (result.ok)
    {
        print("confirmed");
    }
}
 
msgok()
    .title("Information")
    .message("Done")
    .on_result(done)
    .show();

show()

Shows the dialog.

Without `on_result()`, `show()` returns a result `map`.

result = msgok()
    .title("Information")
    .message("Program complete")
    .show();
 
if (result.ok)
{
    print("OK pressed");
}

click_ok()

Clicks OK on an active asynchronous dialog. Returns `true` when the click was accepted.

click_close()

Clicks Close on an active asynchronous dialog. Returns `true` when the click was accepted.


Result Map

Key Type Description
`action` string `ok`, `cancel`, or `none`.
`action_code` number Numeric host action code.
`ok` boolean `true` for OK.
`cancel` boolean `true` for Cancel.
`affirmative` boolean `true` for affirmative choices such as OK or Yes.
`save` boolean Save flag.
`password` string Password text. Empty for `msgok`.

Previous: file_save

Next: msgokcancel

exprv4/reference/objects/dialog_msgok.txt · Last modified: by 127.0.0.1

Page Tools