wxRuby2-preview: strange event of TextCtrl

K

Kuang Dong

...
evt_text(TEXTCTRL_ID){
puts self.get_value
}
...


When I input "Hello",
output:
H
He
Hel
Hell
Hello

When I select "ello",and input "i"
output:
H
Hi

How can I ignore the event outputs "H"?
 
K

Kuang Dong

Paul said:
You have to choose which text events you want to act on. You are
presently
acting on each entered character. I *think* you want to act only on
enter
being pressed.

Acutally,I wanted to do something like google suggest
(http://www.google.com/webhp?complete=1)

When I select "ello" of "Hello" and press "i",two "text change event"
raised,one is Hello->H and the other is H->Hi.Now I have to ignore the
first event(do nothing),and give suggestion by the last word.I have no
idea.
 
A

Alex Fenton

Hi

Kuang said:
..
evt_text(TEXTCTRL_ID){
puts self.get_value
}
..
When I input "Hello", ....
When I select "ello",and input "i"
output:
H
Hi

I don't see this behaviour. If I type in 'Hello', then select 'ello' and overtype with 'i', get_value in the event handler returns 'Hi'.
How can I ignore the event outputs "H"?

Are you looking for event.veto?

evt_text(the_id) { | event | event.veto }

alex
 

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

No members online now.

Forum statistics

Threads
474,212
Messages
2,571,101
Members
47,695
Latest member
KayleneBee

Latest Threads

Top