How to pass data from one textbox to another one?

I

Ivo Roupa

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top