Accept space as starting key for editing numbers in wxGrid
Not being able to use space for starting editing the values of the numeric columns was inconsistent with most (if not all) the other ones and so surprising and inconvenient. Make space work for these columns too, but just ignore it, i.e. in particular do not erase the current cell contents when it's pressed, to avoid changing the old behaviour too much.
This commit is contained in:
@@ -836,10 +836,19 @@ bool wxGridCellNumberEditor::IsAcceptedKey(wxKeyEvent& event)
|
||||
if ( wxGridCellEditor::IsAcceptedKey(event) )
|
||||
{
|
||||
int keycode = event.GetKeyCode();
|
||||
if ( (keycode < 128) &&
|
||||
(wxIsdigit(keycode) || keycode == '+' || keycode == '-'))
|
||||
switch ( keycode )
|
||||
{
|
||||
// Accept +/- because they can be part of the number and space just
|
||||
// because it's a convenient key to start editing with and is also
|
||||
// consistent with many (all?) other editors, which allow starting
|
||||
// editing using it.
|
||||
case '+':
|
||||
case '-':
|
||||
case ' ':
|
||||
return true;
|
||||
|
||||
default:
|
||||
return (keycode < 128) && wxIsdigit(keycode);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user