Class: VR::Alert
Overview
Class that the #alert method uses. This class is note useful by itself. See #alert method instead.
Defined Under Namespace
Classes: DialogAnswer
Instance Attribute Summary collapse
-
#answer ⇒ Object
Returns the value of attribute answer.
Attributes included from GladeGUI
Instance Method Summary collapse
- #before_show ⇒ Object
-
#button_cancel__clicked(but) ⇒ Object
answer stays nil.
- #button_no__clicked(but) ⇒ Object
- #button_yes__clicked(but) ⇒ Object
-
#initialize(message, answer, flags = {}) ⇒ Alert
constructor
Just passes on values from #alert method.
Methods included from GladeGUI
#buttonCancel__clicked, #extract_key, #fill_control, #get_control_value, #get_glade_active_record, #get_glade_all, #get_glade_variables, included, #load_glade, #parse_signals, #set_drag_drop, #set_glade_active_record, #set_glade_all, #set_glade_hash, #set_glade_variables, #show_glade, #try_to_select_text_in_combobox, #window1__destroy, #window1__key_press_event
Constructor Details
#initialize(message, answer, flags = {}) ⇒ Alert
Just passes on values from #alert method.
16 17 18 19 20 21 22 |
# File 'lib/Alert.rb', line 16 def initialize(, answer, flags = {}) @flags = flags @answer = answer @message = @p = nil end |
Instance Attribute Details
#answer ⇒ Object
Returns the value of attribute answer.
8 9 10 |
# File 'lib/Alert.rb', line 8 def answer @answer end |
Instance Method Details
#before_show ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/Alert.rb', line 24 def before_show @flags[:title] = @flags[:title] ? @flags[:title] : @flags[:headline] @builder[:window1].title = @flags[:title] if @flags[:title] @builder[:window1].resize(@flags[:width],100) if @flags[:width].to_i > 100 @builder[:headline].show if @flags[:headline] if @flags[:input_text] @flags[:button_yes] ||= "Save" @flags[:button_no] ||= "Cancel" @builder[:input_text].show elsif choices = @flags[:choices] @flags[:button_yes] ||= "Select" @flags[:button_no] ||= "Cancel" choices.each { |c| @builder[:choices_text].append_text(c) } @choices_text = choices[0] @builder[:choices_text].show end @builder[:button_no].show if @flags[:button_no] @builder[:button_cancel].show if @flags[:button_cancel] set_glade_hash(@flags) end |
#button_cancel__clicked(but) ⇒ Object
answer stays nil
63 64 65 |
# File 'lib/Alert.rb', line 63 def (but) #answer stays nil @builder[:window1].destroy end |
#button_no__clicked(but) ⇒ Object
58 59 60 61 |
# File 'lib/Alert.rb', line 58 def (but) @answer.answer = false @builder[:window1].destroy end |
#button_yes__clicked(but) ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/Alert.rb', line 47 def (but) if @flags[:input_text] @answer.answer = @builder[:input_text].text elsif @flags[:choices] @answer.answer = @builder[:choices_text].active_text else @answer.answer = true end @builder[:window1].destroy end |