From: Ivo Roupa on
Hi all,

I'm trying to create an simple application with two text boxes. One for
writing and the other to show what I'm typing in textbox number one.

How can I use events to do that?

My code is this one:

require 'wx'
include Wx

class MyFrame < Wx::Frame
def initialize
super(nil,
:id => -1,
:pos => DEFAULT_POSITION,
:title => 'EasyMacro',
:size => [900,600],
:style => DEFAULT_FRAME_STYLE,
:name => "Ivo"
)

@panel = Wx::Panel.new(self)

@text_box_1 = Wx::TextCtrl.new(@panel,
:id => 1,
:value => "",
:pos => [0,50],
:size => [400,500],
:style => TE_MULTILINE,
:validator => DEFAULT_VALIDATOR,
:name => 'TextCtrlNameStr_1'
)

@text_box_2 = Wx::TextCtrl.new(@panel,
:id => 2,
:value => "",
:pos => [450,50],
:size => [400,500],
:style => TE_READONLY,
:validator => DEFAULT_VALIDATOR,
:name => 'TextCtrlNameStr_2'
)

evt_text(1) { |event| @text_box_2 }

show
end
end

class MinApp < App
def on_init
frame = MyFrame.new
end
end

MinApp.new.main_loop

Thanks in advance

Ivo Roupa
--
Posted via http://www.ruby-forum.com/.