Here’s my code for:
evt_menu(@m_menu_paste) { pastetext } using wxruby2.0
def pastetext
# this function is used to paste text from the clipboard and
# does a simple test to see if the pasted text is a number
# or a valid arithmetic expression
# if not then restore the previous contents of the textctrl
# (the calculator’s window) to its original state
@m_textctrl.set_editable(true)
start_value = @m_textctrl.get_value()
@m_textctrl.paste
end_value = @m_textctrl.get_value()
puts "start value:::" + start_value
puts "end value:::::" + end_value
@m_textctrl.set_editable(false)
end
When I run my calculator program I get the following output
ClipBoard Data: 123456
Calculator’s textctrl: 0123456 # I’m not worried about the zero
Shell Output:
start value:::0
end value:::::0 # I was hoping this would be 0123456
I was hoping that I could manipulate the end_value but the paste event
does not fire until after the routine is finished. I tried
process_event
but could not manage to get the right syntax. Any help would be
appreciated.
Thanks,
Philip