Module: Bowline::Desktop::Dialog
- Defined in:
- lib/bowline/desktop/dialog.rb
Class Method Summary collapse
-
.message(msg, options = {}) ⇒ Object
Display a dialog box from the main window.
Class Method Details
.message(msg, options = {}) ⇒ Object
Display a dialog box from the main window. You can ask for a confirmation, or just display some information.
Supported options are:
:yes_no - Puts Yes and No buttons on the message box *
:ok - Puts an Ok button on the message box *
:cancel - Puts a Cancel button on the message box
:icon_exclamation - Displays an exclamation mark symbol
:icon_error - Displays an error symbol
:question - Displays a question mark symbol
:information - Displays an information symbol
:caption - Title for the message box
* may be combined with :cancel
Return values are:
:yes - User clicked yes
:no - User clicked no
:ok - User clicked ok
:cancel - User clicked cancel, or closed the box
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/bowline/desktop/dialog.rb', line 23 def (msg, = {}) style = 0 style |= YES_NO if [:yes_no] style |= OK if [:ok] style |= CANCEL if [:cancel] style |= ICON_EXCLAMATION if [:icon_exclamation] style |= ICON_HAND if [:icon_hand] style |= ICON_ERROR if [:icon_error] style |= QUESTION if [:question] style |= INFORMATION if [:information] = [:caption] || "Message" result = (msg, , style) case result when YES then :yes when NO then :no when OK then :ok when CANCEL then :cancel end end |