On Tue, Apr 6, 2010 at 6:04 PM, Alex Fenton <alex at pressure.to> wrote:
> Hi Hendra
>
>
> hendra kusuma wrote:
>
>> what is a good way to implement a textbox that can only receive number?
>>
>
> The best way is to use Validators. There''s a pre-built one for
controlling
> numerics:
>
> Wx::TextCtrl.new(parent,
> :validator => Wx::TextValidator.new(Wx::FILTER_NUMERIC) )
>
I tried filter_numeric before
and found out if it only filter input, not realy confirm if the number
correct
I try to workaround a bit using key_update event
and filter some more key like + - , . e
well, it works well, the trick is to use* change_value*, not *set_value*
somehow, when I try to add humanizing number function, I got stuck
(humanizing = 10000 -> 10,000)
because I cannot move my cursor / insert point to the last of textctrl
and *set_insertion_point_end* does not seem to work
is there a way to fix this?
--
Suka linux?
Kunjungi blog saya http://penguinroad.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/wxruby-users/attachments/20100407/02d4cf61/attachment-0001.html>