J
John
Hi Folks,
I'm experimenting a little with creating a custom CEdit control so that
I can decide on what the user is allowed to type into the control. I
started off only allowing floating point numbers then added support for
putting in lat/lon coordinates.
I tried this little piece of code inside the OnChar function but
compiler complained about missing ';' after "case _T('W'):"
switch(nChar)
{
if(m_bLATLON) // if latlon then no negs and 4 extra chars.
{
case _T('N'):
case _T('E'):
case _T('S'):
case _T('W'):
}
else
case _T('-'); // if not latlon we are allowed negs.
case _T('.'): // allowed characters on both cases.
case _T('0'):
case _T('1'):
case _T('2'):
case _T('3'):
case _T('4'):
case _T('5'):
case _T('6'):
case _T('7'):
case _T('8'):
case _T('9'):
case _T('\b'):
break;
default:
return;
}
now I could just have the 'if' statement first and then have two
seperate switch statements but i would rather do the method above as it
'looks' more elegante )
Is there some magic way to do what I am wanting or does it just break
the rules of c++ ?
Cheers,
John.
I'm experimenting a little with creating a custom CEdit control so that
I can decide on what the user is allowed to type into the control. I
started off only allowing floating point numbers then added support for
putting in lat/lon coordinates.
I tried this little piece of code inside the OnChar function but
compiler complained about missing ';' after "case _T('W'):"
switch(nChar)
{
if(m_bLATLON) // if latlon then no negs and 4 extra chars.
{
case _T('N'):
case _T('E'):
case _T('S'):
case _T('W'):
}
else
case _T('-'); // if not latlon we are allowed negs.
case _T('.'): // allowed characters on both cases.
case _T('0'):
case _T('1'):
case _T('2'):
case _T('3'):
case _T('4'):
case _T('5'):
case _T('6'):
case _T('7'):
case _T('8'):
case _T('9'):
case _T('\b'):
break;
default:
return;
}
now I could just have the 'if' statement first and then have two
seperate switch statements but i would rather do the method above as it
'looks' more elegante )
Is there some magic way to do what I am wanting or does it just break
the rules of c++ ?
Cheers,
John.