wx.grid.GRID_VALUE_NUMBER

Timothy Smith wrote:

hello wx people,

i'm using wx.grid.GRID_VALUE_NUMBER for the data type for a column in my grid, but i've found the default behaviour of it sucks due to the fact if you TAB to it, press a key, it goes into edit mode and the inital value you tried to enter isn't inserted.
whats the best way for me to work around this? the column needs the constraint 1 - 2359 and must be an int

wxGridCellNumberEditor::StartingKey doesn't do anything with the starting key if there is a range defined. I'm not sure if there is a reason for this or not, perhaps just because the editor in this case is a spinctrl and so the default starting key code for a textctrl wouldn't work. I'll see what I can do about it...

i was thinking along the lines of using the string type instead and using a validator or something to stop entry of anything but values between 1 and 2359

That would probably be doable. There is an EDITOR_CREATED event that you can catch to attach your validator to the control.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Timothy Smith wrote:

hello wx people,

i'm using wx.grid.GRID_VALUE_NUMBER for the data type for a column in my grid, but i've found the default behaviour of it sucks due to the fact if you TAB to it, press a key, it goes into edit mode and the inital value you tried to enter isn't inserted.
whats the best way for me to work around this? the column needs the constraint 1 - 2359 and must be an int

wxGridCellNumberEditor::StartingKey doesn't do anything with the starting key if there is a range defined. I'm not sure if there is a reason for this or not, perhaps just because the editor in this case is a spinctrl and so the default starting key code for a textctrl wouldn't work. I'll see what I can do about it...

i was thinking along the lines of using the string type instead and using a validator or something to stop entry of anything but values between 1 and 2359

That would probably be doable. There is an EDITOR_CREATED event that you can catch to attach your validator to the control.

had any luck modifying it's behavour? i haven't been able to get the validator to work

Timothy Smith wrote:

Robin Dunn wrote:

Timothy Smith wrote:

hello wx people,

i'm using wx.grid.GRID_VALUE_NUMBER for the data type for a column in my grid, but i've found the default behaviour of it sucks due to the fact if you TAB to it, press a key, it goes into edit mode and the inital value you tried to enter isn't inserted.
whats the best way for me to work around this? the column needs the constraint 1 - 2359 and must be an int

wxGridCellNumberEditor::StartingKey doesn't do anything with the starting key if there is a range defined. I'm not sure if there is a reason for this or not, perhaps just because the editor in this case is a spinctrl and so the default starting key code for a textctrl wouldn't work. I'll see what I can do about it...

i was thinking along the lines of using the string type instead and using a validator or something to stop entry of anything but values between 1 and 2359

That would probably be doable. There is an EDITOR_CREATED event that you can catch to attach your validator to the control.

had any luck modifying it's behavour? i haven't been able to get the validator to work

Yeah, I made a change in 2.6.0.1.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!