EVT_SCROLLWIN(wxScrolledWindow::OnScroll)
EVT_SIZE(wxScrolledWindow::OnSize)
EVT_PAINT(wxScrolledWindow::OnPaint)
- EVT_KEY_DOWN(wxScrolledWindow::OnKeyDown)
+ EVT_CHAR(wxScrolledWindow::OnChar)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxScrolledWindow, wxPanel)
OnDraw(dc);
}
-// kbd handling
-void wxScrolledWindow::OnKeyDown(wxKeyEvent& event)
+// kbd handling: notice that we use OnChar() and not OnKeyDown() for
+// compatibility here - if we used OnKeyDown(), the programs which process
+// arrows themselves in their OnChar() would never get the message and like
+// this they always have the priority
+void wxScrolledWindow::OnChar(wxKeyEvent& event)
{
int stx, sty, // view origin
szx, szy, // view size (total)
ViewStart(&stx, &sty);
GetClientSize(&clix, &cliy);
- clix /= m_xScrollPixelsPerLine;
- cliy /= m_yScrollPixelsPerLine;
GetVirtualSize(&szx, &szy);
- szx /= m_xScrollPixelsPerLine;
- szy /= m_yScrollPixelsPerLine;
+
+ if( m_xScrollPixelsPerLine )
+ {
+ clix /= m_xScrollPixelsPerLine;
+ szx /= m_xScrollPixelsPerLine;
+ }
+ else
+ {
+ clix = 0;
+ szx = -1;
+ }
+ if( m_yScrollPixelsPerLine )
+ {
+ cliy /= m_yScrollPixelsPerLine;
+ szy /= m_yScrollPixelsPerLine;
+ }
+ else
+ {
+ cliy = 0;
+ szy = -1;
+ }
switch ( event.KeyCode() )
{