Class: Rediscover::Panel::StringView
- Inherits:
-
Wx::Panel
- Object
- Wx::Panel
- Rediscover::Panel::StringView
- Includes:
- KeyViewer, Wx
- Defined in:
- lib/rediscover/panel/string_view.rb
Instance Method Summary collapse
-
#initialize(parent, key) ⇒ StringView
constructor
A new instance of StringView.
- #save ⇒ Object
- #setup ⇒ Object
Methods included from KeyViewer
#do_on_close, #do_on_save, #on_close, #on_save
Constructor Details
#initialize(parent, key) ⇒ StringView
Returns a new instance of StringView.
7 8 9 10 11 12 13 14 15 |
# File 'lib/rediscover/panel/string_view.rb', line 7 def initialize(parent, key) @parent = parent super(@parent, -1, :style => SUNKEN_BORDER) @key = key @redis = get_app.redis setup end |
Instance Method Details
#save ⇒ Object
43 44 45 46 |
# File 'lib/rediscover/panel/string_view.rb', line 43 def save @redis[@key] = @value_textbox.get_value do_on_save end |
#setup ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rediscover/panel/string_view.rb', line 17 def setup value = @redis[@key] @sizer = BoxSizer.new(VERTICAL) set_sizer(@sizer) @key_label = StaticText.new(self, :label => "Key: #{@key}") @value_textbox = TextCtrl.new(self, :value => value, :style => TE_MULTILINE|TE_DONTWRAP) @button_sizer = BoxSizer.new(HORIZONTAL) @save_button = Button.new(self, :label => 'Save') @save_button, :save @close_button = Button.new(self, :label => 'Close') @close_button, :do_on_close @sizer.add_item(@key_label, :flag => ALL, :border => 2) @sizer.add_item(@value_textbox, :proportion => 1, :flag => EXPAND|ALL, :border => 2) @sizer.add_item(@button_sizer) @button_sizer.add_item(@save_button, :flag => ALL, :border => 2) @button_sizer.add_item(@close_button, :flag => ALL, :border => 2) end |