[wxruby-users] wxruby, XRC, DialogBlock

Joshua Lefkowitz lists at ruby-forum.com
Thu Mar 6 13:09:19 EST 2008


> Joshua Lefkowitz wrote:
>> syntax error, unexpected '\n', expecting tCOLON2 or '[' or '.'
> Please could you post your XRC file and the generated code. Thanks.

Alex, here's the code (from the XRCise tutorial)

---------------

 require 'wx'
 # load in the generated code
 require 'my_frame'

 # Mix-in for a Wx::TextCtrl
 module CaseChangeTextCtrl?
   # convert all the text in the control to upper case
   def upcase!
     self.value = self.value.upcase
   end
   # convert all the text in the control to lower case
   def downcase!
     self.value = self.value.downcase
   end
 end

 # Inherit from the generated base class and set up event handlers
 class CaseChangeFrame? < TextFrameBase?
   def initialize
     super
     evt_button(upper_bt) { text_box.upcase! }
     evt_button(lower_bt) { text_box.downcase! }
   end
 end

 # Run the class
 Wx::App.run do
   CaseChangeFrame?.new.show
 end
------------

Josh
-- 
Posted via http://www.ruby-forum.com/.


More information about the wxruby-users mailing list