[wxruby-users] New problem: Newlines.

Tim Mcd lists at ruby-forum.com
Thu Jan 8 20:18:47 EST 2009


Sorry for even more noobiness, but; did I just find a new problem?

Code [
require 'rubygems'
require 'socket'
require 'wx'
include Wx

$connection = TCPSocket.new("dark-legacy.com", 9898)

class GuiMudClientApp < App
  THREAD_TIMER_ID = ID_HIGHEST + 1
  def on_init
    #Timer.every(25) { Thread.pass }
    frame = Frame.new(nil, -1, "GMC: Incoming", Point.new(100, 100), 
Size.new(500, 550))
    test = TextCtrl.new(frame, -1, "-----Mud stuff here-----", 
Point.new(0, 0), Size.new(500, 500), TE_READONLY)
    test.append_text "Pfft!"
    test2 = TextCtrl.new(frame, 10, "Output here!", Point.new(0, 501), 
Size.new(500, 25), TE_PROCESS_ENTER)
    frame.show
    evt_text_enter(10) do |event|
      cmdentered(event.get_string, test2, test)
    end
  end

  def cmdentered(str, textbox, display)
    display.write_text "--(#{str})--"
    $connection.write(str)
    textbox.clear
  end

  def main_loop
    a = Thread.new do
      until connection.closed? == true
        input = $connection.recv(1000000)
        test.append_text input
      end
    end
    Timer.every(25) { Thread.pass } ### LINE 35 <----
    super
  end
end

nowai = GuiMudClientApp.new

nowai.main_loop
]

Error:

/Library/Ruby/Gems/1.8/gems/wxruby-1.9.9-universal-darwin-9/lib/wx/classes/timer.rb:18:in 
`every': uninitialized constant Wxruby2::THE_APP (NameError)
  from guimc.rb:35:in `main_loop'
  from guimc.rb:42

Line 35 is the marked line in the above code. What's wrong?
-- 
Posted via http://www.ruby-forum.com/.


More information about the wxruby-users mailing list