C++ Programming
06-20-2009, 05:51 AM
I need to scroll the CFormView derived view to the top of the form. When I use OnScroll with SB_TOP the form scrolls only one line up after each ESC key press. However, using SendMessage function works just fine.
Am I doing something wrong? (VC 6.0)
Yes, I was not reading "fine print"!
As always please ignore the dereferencing symbol, it is actually "->".
Any constructive comments are appreciated.
Cheers Vaclav
if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam==VK_F2)
{
TRACE("\nBOOL CFD2008View::PreTranslateMessage(MSG* pMsg) VK_F2");
m_edit.SetFocus();
}
if(pMsg->wParam==VK_ESCAPE)
{
TRACE("\nBOOL CFD2008View::PreTranslateMessage(MSG* pMsg) VK_ESCAPE");
ShowWindow(SW_HIDE);
int iPos = 0 ;
SetDlgItemText(IDC_EDIT1,"");
C_ResetCompletionFlags();
SendMessage(WM_VSCROLL, SB_TOP,0); // works OK
OnScroll(SB_TOP,iPos,TRUE); // scrolls one line up only
ShowWindow(SW_SHOWMAXIMIZED);
m_edit.SetFocus();
}
modified on Friday, June 19, 2009 9:44 PM
Am I doing something wrong? (VC 6.0)
Yes, I was not reading "fine print"!
As always please ignore the dereferencing symbol, it is actually "->".
Any constructive comments are appreciated.
Cheers Vaclav
if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam==VK_F2)
{
TRACE("\nBOOL CFD2008View::PreTranslateMessage(MSG* pMsg) VK_F2");
m_edit.SetFocus();
}
if(pMsg->wParam==VK_ESCAPE)
{
TRACE("\nBOOL CFD2008View::PreTranslateMessage(MSG* pMsg) VK_ESCAPE");
ShowWindow(SW_HIDE);
int iPos = 0 ;
SetDlgItemText(IDC_EDIT1,"");
C_ResetCompletionFlags();
SendMessage(WM_VSCROLL, SB_TOP,0); // works OK
OnScroll(SB_TOP,iPos,TRUE); // scrolls one line up only
ShowWindow(SW_SHOWMAXIMIZED);
m_edit.SetFocus();
}
modified on Friday, June 19, 2009 9:44 PM