Method: Wads::Dialog#initialize
- Defined in:
- lib/wads/widgets.rb
#initialize(x, y, width, height, title, text_input_default) ⇒ Dialog
Returns a new instance of Dialog.
2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 |
# File 'lib/wads/widgets.rb', line 2064 def initialize(x, y, width, height, title, text_input_default) super(x, y, width, height) @base_z = 10 @error_message = nil add_text(title, 5, 5) # Forms automatically have some explanatory content add_document(content, 0, 56, width, height) # Forms automatically get a text input widget @textinput = TextField.new(x + 10, bottom_edge - 80, text_input_default, 600) @textinput.base_z = 10 add_child(@textinput) # Forms automatically get OK and Cancel buttons = ("OK", (@width / 2) - 100, height - 32) do handle_ok end .width = 100 = ("Cancel", (@width / 2) + 50, height - 32) do WidgetResult.new(true) end .width = 100 end |