Class: Rbpad::ConsoleInput

Inherits:
Gtk::Entry
  • Object
show all
Defined in:
lib/rbpad/input.rb

Instance Method Summary collapse

Constructor Details

#initialize(conf, drb_portno) ⇒ ConsoleInput

Returns a new instance of ConsoleInput.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rbpad/input.rb', line 9

def initialize(conf, drb_portno)
  super()                             # no argument
  self.override_font(Pango::FontDescription.new("#{conf.platform[:font][:input]}"))
  self.signal_connect("activate") do
    text = self.text
    self.text = ""                    # clear
    puts "Entry contents: #{text}"
    begin
      cl = DRbObject.new_with_uri("druby://127.0.0.1:#{drb_portno}")
      cl.puts(text)                   # sent to DRb server (Emulate STDIN)
    rescue => e
      p e
    end
  end
end