Class: Rediscover::Frame::Connect
- Inherits:
-
Wx::Frame
- Object
- Wx::Frame
- Rediscover::Frame::Connect
- Includes:
- Wx
- Defined in:
- lib/rediscover/frame/connect.rb
Instance Method Summary collapse
- #connect_button_evt ⇒ Object
-
#initialize ⇒ Connect
constructor
A new instance of Connect.
- #setup_panel ⇒ Object
Constructor Details
#initialize ⇒ Connect
Returns a new instance of Connect.
7 8 9 10 11 12 13 14 15 |
# File 'lib/rediscover/frame/connect.rb', line 7 def initialize @app = get_app super(nil, -1, 'Connect to Redis') set_icon(Rediscover::Icon.new('server_connect')) setup_panel show end |
Instance Method Details
#connect_button_evt ⇒ Object
36 37 38 39 40 |
# File 'lib/rediscover/frame/connect.rb', line 36 def host = @host_textbox.get_value port = @port_textbox.get_value.to_i @app.connect(host, port) end |
#setup_panel ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rediscover/frame/connect.rb', line 17 def setup_panel @panel = Wx::Panel.new(self) @host_label = StaticText.new(@panel, :label => 'Host') @host_textbox = TextCtrl.new(@panel, :value => @app.host) @port_label = StaticText.new(@panel, :label => 'Port') @port_textbox = TextCtrl.new(@panel, :value => @app.port.to_s) @connect_button = Button.new(@panel, :label => 'Connect') @connect_button, :connect_button_evt @panel_sizer = BoxSizer.new(VERTICAL) @panel.set_sizer(@panel_sizer) @panel_sizer.add(@host_label, 0, GROW|ALL, 2) @panel_sizer.add(@host_textbox, 0, GROW|ALL, 2) @panel_sizer.add(@port_label, 0, GROW|ALL, 2) @panel_sizer.add(@port_textbox, 0, GROW|ALL, 2) @panel_sizer.add(@connect_button, 0, GROW|ALL, 2) end |