Class: RubyMVC::Toolkit::WxRuby::FormBuilder
- Inherits:
-
Object
- Object
- RubyMVC::Toolkit::WxRuby::FormBuilder
- Defined in:
- lib/ruby_mvc/toolkit/peers/wxruby/form_builder.rb
Overview
This module is a helper class used to build the concrete representations of the FormView controls
Class Method Summary collapse
Instance Method Summary collapse
- #build(parent, form) ⇒ Object
-
#initialize ⇒ FormBuilder
constructor
A new instance of FormBuilder.
- #submit ⇒ Object
- #widget ⇒ Object
Constructor Details
#initialize ⇒ FormBuilder
Returns a new instance of FormBuilder.
40 41 42 43 44 45 |
# File 'lib/ruby_mvc/toolkit/peers/wxruby/form_builder.rb', line 40 def initialize @fields = {} @panel = Wx::BoxSizer.new(Wx::VERTICAL) @sizer = Wx::FlexGridSizer.new(0, 2, 5, 5) @panel.add(@sizer, 0, Wx::ALIGN_CENTER_VERTICAL|Wx::ALL, 5) end |
Class Method Details
.build(parent, form) ⇒ Object
34 35 36 37 38 |
# File 'lib/ruby_mvc/toolkit/peers/wxruby/form_builder.rb', line 34 def self.build(parent, form) builder = self.new builder.build(parent, form) builder end |
Instance Method Details
#build(parent, form) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/ruby_mvc/toolkit/peers/wxruby/form_builder.rb', line 51 def build(parent, form) @form = form form.layout do |key, label, val, editor, disabled| puts "key: #{key}; disabled: #{disabled}" case(editor) when :textarea w = build_textfield(parent, label, val, true) else w = build_textfield(parent, label, val) end @fields[key] = w w.disable if disabled end end |
#submit ⇒ Object
66 67 68 |
# File 'lib/ruby_mvc/toolkit/peers/wxruby/form_builder.rb', line 66 def submit save_form end |
#widget ⇒ Object
47 48 49 |
# File 'lib/ruby_mvc/toolkit/peers/wxruby/form_builder.rb', line 47 def @panel end |