Corretta gestione tasto "decimale" del tastierino numerico

git-svn-id: svn://10.65.10.50/branches/R_10_00@23094 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2015-05-15 08:52:49 +00:00
parent 3b8a54b884
commit 301b53b2f0

@ -554,28 +554,9 @@ long TwxWindow::DoXvtEvent(EVENT& e)
void TwxWindow::OnChar(wxKeyEvent& evt)
{
static int nSkipNextDotKey = -883; // Valore indefinito
if (nSkipNextDotKey == -883) // Devo stabilire se attivare la gestione o no
{
const char* campoini = xvt_fsys_get_campo_ini();
char str[2];
xvt_sys_get_profile_string(campoini, "Main", "Point2Comma", "1", str, sizeof(str));
nSkipNextDotKey = strchr("1XY", *str) != NULL ? 0 : -1; // Dis/Abilita conversione punto in virgola
}
XVT_EVENT e(E_CHAR);
int k = evt.GetKeyCode();
if (nSkipNextDotKey == 1)
{
nSkipNextDotKey = 0;
if (k == '.')
{
evt.Skip();
return;
}
}
switch (k)
{
case WXK_ALT:
@ -592,14 +573,6 @@ void TwxWindow::OnChar(wxKeyEvent& evt)
case WXK_NUMPAD9:
evt.Skip();
return;
case WXK_NUMPAD_DECIMAL: // Arriva solo dalla 2.6.3 in poi
case WXK_DECIMAL: // ??? Arriva sia '.' sia WXK_DECIMAL=340
if (nSkipNextDotKey == 0)
{
k = ','; // Trasformo il punto in virgola
nSkipNextDotKey = 1;
}
break;
case WXK_NUMPAD_ADD: k = '+';break;
case WXK_DOWN : k = K_DOWN; break;
case WXK_END : k = K_LEND; break;
@ -654,8 +627,19 @@ void TwxWindow::OnKeyDown(wxKeyEvent& e)
} else
if (k == WXK_NUMPAD_DECIMAL)
{
OnChar(e);
return;
static int nPoint2Comma = -883; // Valore indefinito
if (nPoint2Comma == -883) // Devo stabilire se attivare la gestione o no
{
char str[4] = { 0 };
xvt_sys_get_profile_string(NULL, "Main", "Point2Comma", "1", str, sizeof(str));
nPoint2Comma = wxStrchr("1XY", *str) ? 1 : 0; // Dis/Abilita conversione punto in virgola
}
if (nPoint2Comma)
{
e.m_keyCode = ',';
OnChar(e);
return;
}
}
e.Skip();
}