Top Level Namespace
Defined Under Namespace
Instance Method Summary collapse
-
#alert(message, options = {}) ⇒ String, ...
The alert method creates a pop-up alert in your program.
-
#clear_events ⇒ Object
Waits for all penting events to finish before continuing.
-
#oinspect(obj = self) ⇒ Object
Displays object on screen and halts the program.
Instance Method Details
#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 displaying a text entry box for getting text input from the user. 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 add the option, :input_text, a text entry box will appear.
There are many examples in the “alert_box” example project.
105 106 107 108 109 |
# File 'lib/Alert.rb', line 105 def alert(, = {}) ans = VR::Alert::DialogAnswer.new() VR::Alert.new(, ans, ).show_glade([:parent]) return ans.answer end |
#clear_events ⇒ Object
Waits for all penting events to finish before continuing.
458 459 460 461 462 |
# File 'lib/GladeGUI.rb', line 458 def clear_events() while (Gtk.events_pending?) Gtk.main_iteration end end |
#oinspect(obj = self) ⇒ Object
Displays object on screen and halts the program. Anywhere in your code you can halt the execution, and display an object in a window like this:
alert anyobject
Also, at any window, if you press the F8 key, the object inspector will run. Try it.
43 44 45 |
# File 'lib/oinspect/ObjectInspectorGUI.rb', line 43 def oinspect(obj=self) VR::ObjectInspector::ObjectInspectorGUI.new(obj).show_glade() end |