Method: #alert
- Defined in:
- lib/AlertDialog.rb
#alert(message, options = {}) ⇒ String, ...
The alert method creates a pop-up alert in your program. It creates a modal window that halts execution of your code until the user closes it. Its great for displaying messages and debugging. It also has the option of allowing the user input in the form of a String or a selection from a Hash or Array. This small tool can save hundreds of lines of code in your programs. It can be used extesnively to display all types of messages and request all types of user input.
The alert box can disply 1, 2 or 3 buttons. The first button is denoted using the symbol: :button_yes button and is always displayed. You can add :button_no and :button_cancel.
If you want to add these buttons, just set their values to whatever text you want them to display and they will appear. Likewise, if you pass a :data parameter with a String, Hash or Array, it will ask for user input.
There are many examples in the “alert_box” example project.
140 141 142 143 |
# File 'lib/AlertDialog.rb', line 140 def alert(, = {}) win = VR::AlertDialog.new(, ) return win.run() end |