masked.NumCtrl does not selectOnEntry on Mouse Entry?

I need an input control that accepts numeric value only (for a dollar amount).
I am using maskedNumCtrl, which works nicely except if the user click on
the middle of an empty field attempting to enter the field, then start typing,

The control would refuse the keystrokes because it is in the middle of
the field. The control expects the initial insertion point to be on the far
right (for a right justified numeric field).

The control works if the user "tab" into the field, because the insertion
point is placed on the far right.

Is there a solution to this? Or should I use a different input control?
(wxPython 2.8.9.1 on both OSX and XP)

Thanks,
P.K.

PK Shiu wrote:

I need an input control that accepts numeric value only (for a dollar amount).
I am using maskedNumCtrl, which works nicely except if the user click on
the middle of an empty field attempting to enter the field, then start typing,

The control would refuse the keystrokes because it is in the middle of
the field. The control expects the initial insertion point to be on the far
right (for a right justified numeric field).

The control works if the user "tab" into the field, because the insertion
point is placed on the far right.

Is there a solution to this? Or should I use a different input control?
(wxPython 2.8.9.1 on both OSX and XP)

Thanks,
P.K.

You can force the insertion point to always be at zero using the control's SetInsertionPoint() method. Or you could just use Validators instead of the masked control.

···

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

Thanks Mike. Just setting the insertion point at control creation
point is not going to work, right? I need to hook it into a mouse
event? Not sure if it is that simple?

I switched to, as you suggested, just a TextCtrl with a validator with
onChar checking.
I do loose the nice numeric formatting.

P.K.

···

On Mon, Feb 16, 2009 at 12:35 PM, Mike Driscoll <mike@pythonlibrary.org> wrote:

You can force the insertion point to always be at zero using the control's
SetInsertionPoint() method. Or you could just use Validators instead of the
masked control.

PK Shiu wrote:

Thanks Mike. Just setting the insertion point at control creation
point is not going to work, right? I need to hook it into a mouse
event? Not sure if it is that simple?

I switched to, as you suggested, just a TextCtrl with a validator with
onChar checking.
I do loose the nice numeric formatting.

P.K.
  
I didn't mean to set the insertion point on creation of the widget, but catch the focus event and set it then. That should work...

Mike

···

On Mon, Feb 16, 2009 at 12:35 PM, Mike Driscoll <mike@pythonlibrary.org> wrote:
  

You can force the insertion point to always be at zero using the control's
SetInsertionPoint() method. Or you could just use Validators instead of the
masked control.

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users