digit/integer value from wxTextCtrl

Guys help me out. I wanna make user only enter
integer/digit in wxTextCtrl.

Dan Cherry wrote:

Guys help me out. I wanna make user only enter
integer/digit in wxTextCtrl.

There's an excellent integer control in the demo that comes with
wxPython 2.4.0.7. The first section (called Recent
Additions) contains "wxIntCtrl" which should be exactly what
you're looking for. Unfortunately, I don't know if it's
included in, or accessible from Boa - maybe someone else has
some experience with adding or using Boa controls.

wxIntCtrl was written to supply a native "integer" control for
wxPython, that is, you get and set integer values, (or longs,
if you like) rather than strings, and the control manages the
character input, signs, bounds (if any) etc, and always ensures
a "legal" ie. convertable text value. It's all written in
Python and uses character event handlers in its validator to
control input, so you can look at the code how I did it, if
for some reason you want to write your own or just want to
understand...
(As for the access from Boa, I don't know; I use wxDesigner,
which has facilities for using "foreign controls" that allow
me to lay out and use my controls.)

Uwe Schroeder wrote:

take a look at maskededit.py in the current CVS tree under lib/
It can do that and more.

I also had a (heavy) hand in writing wxMaskedTextCtrl, soon(?)
to be released in the next version of wxPython. It's a little
different, in that it is designed to be a *fixed-width text*
control that allows you to enter strings that only match certain
patterns and/or character types, and allows non-editable "template"
characters to be in fixed positions within the control.

With it, you can create a control that only allows digits to be
typed, but it's still a *text* control, and you'd then have to
manage conversions and such yourself. Still, it handles "fixed
floating point" entry mechanics, and I like some of its numeric
input mechanics better (eg: it's the 1st control I'm aware of that
supports "right-insert entry", allowing input similar to a
calculator display. (I hope to one day rewrite and derive wxIntCtrl
from wxMaskedTextCtrl, but not for a while yet...)

Anyway, depending on your needs, one of these should do the trick!
Regards,
/Will Sadkin
Parlance Corporation
www.nameconnector.com

ยทยทยท

On Sunday 08 June 2003 07:15 pm, danu kusmana wrote:

On Sunday 08 June 2003 07:15 pm, danu kusmana wrote: