function, without any translation from virtual keycode to character.
without actually doing it.
one with the ASCII codes. But them next to each other. You will see that
the same ones in the ASCII list.
alphanumeric symbol. So will the F1 thru F11 (not the F12) keys.
character please) and see what Windows itself thinks that they represent.
no lowercase. Your numeric keys will also return something, but not what you
typed.
characters you than I do not know what, if anything, will ...
Post by Stephen WolstenholmePost by R.Wieser2) Alas, your post does not contain any code, which denies us the
possibility to determine and point-out the actual problem.
I did not to post the code but here it is:-
void CEasyNNView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if(theApp.m_nTraceLevel > 0)
theApp.Trace(_T("OnKeyDown"));
CEasyNNDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CDiagnostics dlgDiagnostics;
COrder dlgOrder;
int nResult = NOT_EDITED;
int nFound;
SHORT nLShift = 0;
SHORT nRShift = 0;
SHORT nControl = 0;
// Stop first click move
theApp.m_bInit = FALSE;
UINT nScroll;
CString strChar, strTemp;
CString strDefaults, strNames;
CFileStatus fileStatus;
BYTE byteKeyboardState[256];
switch(nChar)
{
if(pDoc->m_bViewGrid)
{
if(m_bLastVert)
{
OnVScroll(SB_TOP, 0, GetScrollBarCtrl(SB_VERT));
GoTo(0, m_nCellCol);
}
else
{
OnHScroll(SB_LEFT, 0, GetScrollBarCtrl(SB_HORZ));
GoTo(m_nCellRow, 0);
}
}
if(pDoc->m_bViewGraphColumn || pDoc->m_bViewSensitivity)
{
m_nCellCol = 0;
pDoc->Refresh();
Invalidate();
}
if(pDoc->m_bViewAssociations)
OnVScroll(SB_TOP, 0, GetScrollBarCtrl(SB_VERT));
break;
if(pDoc->m_bViewGrid)
{
if(m_bLastVert)
{
OnVScroll(SB_BOTTOM, 0, GetScrollBarCtrl(SB_VERT));
GoTo(pDoc->m_nRows - 1, m_nCellCol);
}
else
{
OnHScroll(SB_RIGHT, 0, GetScrollBarCtrl(SB_HORZ));
GoTo(m_nCellRow, pDoc->m_nCols - 1);
}
}
if(pDoc->m_bViewGraphColumn || pDoc->m_bViewSensitivity)
{
m_nCellCol = pDoc->m_nCols - 1;
pDoc->Refresh();
Invalidate();
}
if(pDoc->m_bViewAssociations)
OnVScroll(SB_BOTTOM, 0, GetScrollBarCtrl(SB_VERT));
break;
OnVScroll(SB_PAGEUP, 0, GetScrollBarCtrl(SB_VERT));
m_bLastVert = TRUE;
break;
OnVScroll(SB_PAGEDOWN, 0, GetScrollBarCtrl(SB_VERT));
m_bLastVert = TRUE;
break;
if(pDoc->m_bViewGrid || pDoc->m_bViewGraphColumn)
{
if(m_nCellRow < pDoc->m_nRows)
{
m_nCellRow++;
if(CellTooLow() && pDoc->m_bViewGrid)
{
nScroll = GetVScrollInfo(POS);
SetVScrollInfo(POS, nScroll + m_nRowHeight);
m_nScrollRows++;
Invalidate();
}
}
}
else
OnVScroll(SB_LINEDOWN, 0, GetScrollBarCtrl(SB_VERT));
m_bLastVert = TRUE;
break;
if(pDoc->m_bViewGrid || pDoc->m_bViewGraphColumn)
{
if(m_nCellRow > 0)
{
m_nCellRow--;
if(CellTooHigh() && pDoc->m_bViewGrid)
{
nScroll = GetVScrollInfo(POS);
SetVScrollInfo(POS, nScroll - m_nRowHeight);
m_nScrollRows--;
Invalidate();
}
}
}
else
OnVScroll(SB_LINEUP, 0, GetScrollBarCtrl(SB_VERT));
m_bLastVert = TRUE;
break;
if(pDoc->m_bViewGrid)
{
if(m_nCellCol < pDoc->m_nCols)
{
m_nCellCol++;
if(CellTooRight())
{
nScroll = GetHScrollInfo(POS);
SetHScrollInfo(POS, nScroll + m_nColWidth);
m_nScrollCols++;
Invalidate();
}
}
}
else if(pDoc->m_bViewGraphColumn || pDoc->m_bViewSensitivity)
{
if(m_nCellCol < pDoc->m_nCols - 1)
m_nCellCol++;
if(m_nCellCol > pDoc->m_nCols - 1)
m_nCellCol = pDoc->m_nCols - 1;
if(pDoc->m_bViewSensitivity)
{
CInOut* pInOut = NULL;
pInOut = pDoc->GetInOut(m_nCellCol);
while(pInOut->m_nInOutType != IN_OUT_OUTPUT)
{
m_nCellCol++;
if(m_nCellCol > pDoc->m_nCols - 1)
{
m_nCellCol = pDoc->m_nCols - 1;
break;
}
pInOut = pDoc->GetInOut(m_nCellCol);
}
}
pDoc->Refresh();
Invalidate();
}
else
OnHScroll(SB_LINERIGHT, 0, GetScrollBarCtrl(SB_HORZ));
m_bLastVert = FALSE;
break;
if(pDoc->m_bViewGrid)
{
if(m_nCellCol > 0)
{
m_nCellCol--;
if(CellTooLeft())
{
nScroll = GetHScrollInfo(POS);
SetHScrollInfo(POS, nScroll - m_nColWidth);
m_nScrollCols--;
Invalidate();
}
}
}
else if(pDoc->m_bViewGraphColumn || pDoc->m_bViewSensitivity)
{
if(m_nCellCol > 0)
m_nCellCol--;
if(m_nCellCol < 0)
m_nCellCol = 0;
if(pDoc->m_bViewSensitivity)
{
CInOut* pInOut = NULL;
pInOut = pDoc->GetInOut(m_nCellCol);
while(pInOut->m_nInOutType != IN_OUT_OUTPUT)
{
m_nCellCol--;
if(m_nCellCol < 0)
{
m_nCellCol = 0;
break;
}
pInOut = pDoc->GetInOut(m_nCellCol);
}
}
pDoc->Refresh();
Invalidate();
}
else
OnHScroll(SB_LINELEFT, 0, GetScrollBarCtrl(SB_HORZ));
m_bLastVert = FALSE;
break;
if(pDoc->m_bViewGrid)
{
pDoc->m_nSelectedCol = NONE;
pDoc->m_nSelectedRow = NONE;
Invalidate();
}
break;
if(pDoc->m_bIsLearning)
break;
if(theApp.m_bTrace)
{
theApp.m_bTrace = FALSE;
AfxMessageBox(_T("Tracing has been switched off"));
break;
}
dlgDiagnostics.m_nWarnLevel = 0;
dlgDiagnostics.m_nTraceLevel = theApp.m_nTraceLevel;
dlgDiagnostics.m_strEditTraceKeyword =
theApp.m_strTraceKeyword;
if(dlgDiagnostics.DoModal() == IDOK)
{
theApp.m_nWarnLevel = dlgDiagnostics.m_nWarnLevel;
theApp.m_nTraceLevel = dlgDiagnostics.m_nTraceLevel;
theApp.m_strTraceKeyword =
dlgDiagnostics.m_strEditTraceKeyword;
theApp.m_nTraceCount = 0;
theApp.m_nTraceRepeats = 0;
theApp.m_nTraceCycles = 0;
theApp.m_strLastTrace.Empty();
if(theApp.m_nTraceLevel > 0)
{
CFile file;
CFileException fileException;
theApp.m_strTraceName = _T("enntrace.txt");
CFileDialog dlgFile(FALSE, _T("txt"),
theApp.m_strTraceName, NULL, NULL);
// Create new trace file
dlgFile.m_ofn.lpstrTitle = _T("Open trace file");
if(dlgFile.DoModal() == IDOK)
{
theApp.m_strTraceName = dlgFile.GetPathName();
if(!file.Open(theApp.m_strTraceName,
CFile::modeCreate | CFile::modeNoTruncate, &fileException))
{
// Try again
if(!file.Open(theApp.m_strTraceName,
CFile::modeCreate | CFile::modeNoTruncate, &fileException))
{
theApp.m_bTrace = FALSE;
return;
}
}
file.Close();
theApp.m_bTrace = TRUE;
}
}
}
break;
if(pDoc->m_bIsLearning)
break;
strDefaults = theApp.GetProfileString(_T("Tips1"),
_T("OpenDefaults"), NULL);
theApp.m_nDisplayBool++;
if(theApp.IsDefault(ID_DEFAULTS_OPEN))
{
strTemp = _T("Bool Names = ");
nFound = strDefaults.Find(strTemp);
if(nFound > 0)
strTemp = strDefaults.Mid(nFound, strTemp.GetLength()
+ 2);
strNames.Format(_T("Bool Names = %d"),
theApp.m_nDisplayBool);
strDefaults.Replace(strTemp, strNames);
theApp.WriteProfileString(_T("Tips1"),
_T("OpenDefaults"), strDefaults);
}
}
Invalidate();
pDoc->SetModifiedFlag();
break;
if(pDoc->m_bIsLearning)
break;
theApp.m_nDisplayNumbers++;
if(theApp.m_nDisplayNumbers > 2)
theApp.m_nDisplayNumbers = 0;
pDoc->SetModifiedFlag();
break;
#ifdef TRIAL
if(pDoc->m_bIsLearning)
break;
dlgOrder.DoModal();
break;
#endif
if(pDoc->m_bViewGrid)
{
theApp.m_bMove = FALSE;
theApp.m_bReturn = FALSE;
nLShift = GetAsyncKeyState(VK_LSHIFT);
nRShift = GetAsyncKeyState(VK_RSHIFT);
GetKeyboardState(byteKeyboardState);
if(theApp.m_bUndo)
pDoc->EnableCheckPoint();
else
pDoc->DisableCheckPoint();
if(theApp.m_bDemoRunning)
{
nControl = GetAsyncKeyState(VK_CONTROL);
if(nControl & 0x8000)
break;
}
if(isalnum(nChar) || nChar == 96 /* Num pad 0 */ || nChar
== 187 || nChar == 188 || nChar == 189 || nChar == 190 || nChar ==
191)
{
GoTo(m_nCellRow, m_nCellCol);
nChar = MapVirtualKey(nChar, 2);
nChar = tolower(nChar);
if(byteKeyboardState[VK_CAPITAL] || (nLShift & 0x8000)
|| (nRShift & 0x8000))
nChar = toupper(nChar);
nResult = EditGrid(nChar);
theApp.m_bMove = TRUE;
}
if(nChar == VK_RETURN || nChar == VK_SPACE)
{
GoTo(m_nCellRow, m_nCellCol);
// Must do before EditGrid
theApp.m_bReturn = TRUE;
nResult = EditGrid();
}
switch(nResult)
{
pDoc->AddRow();
pDoc->AddCol(TRUE, FALSE, TRUE);
break;
if(theApp.m_bPresets)
Insert(EXAMPLE_TRAINING, INSERT_ALL,
pDoc->m_nRows);
else
pDoc->AddRow();
break;
pDoc->AddCol(TRUE, FALSE, TRUE);
break;
}
if(nResult != NOT_EDITED)
{
Invalidate();
NextCell();
if(CellTooHigh())
{
nScroll = GetVScrollInfo(POS);
SetVScrollInfo(POS, nScroll - m_nRowHeight);
m_nScrollRows--;
Invalidate();
}
else if(CellTooLeft())
{
nScroll = GetHScrollInfo(POS);
SetHScrollInfo(POS, nScroll - m_nColWidth);
m_nScrollCols--;
Invalidate();
}
else if(CellTooRight())
{
nScroll = GetHScrollInfo(POS);
SetHScrollInfo(POS, nScroll + m_nColWidth);
m_nScrollCols++;
Invalidate();
}
else if(CellTooLow())
{
nScroll = GetVScrollInfo(POS);
SetVScrollInfo(POS, nScroll + m_nRowHeight);
m_nScrollRows++;
Invalidate();
}
}
}
}
theApp.m_bMark = FALSE;
MarkGridCell();
AlignVerticalScroll();
::PostMessage(AfxGetMainWnd()->m_hWnd, WM_APP_POSITION,
m_nCellRow, m_nCellCol);
if(!pDoc->m_bViewGrid)
m_bLastVert = TRUE;
CScrollView::OnKeyDown(nChar, nRepCnt, nFlags);
}
--
EasyNN-plus. Neural Networks plus. http://www.easynn.com
SwingNN. Forecast with Neural Networks. http://www.swingnn.com
JustNN. Just Neural Networks. http://www.justnn.com