LeChuck2k
LeChuck2k

Reputation: 323

Scrolling Dialog in MFC on Win CE / Windows Mobile

I'm building a dialog based Windows Mobile application. My main container dialog has a tab control which alternates between different child dialogs (as separate tab sheets).

As I have limited display real-estate I need my dialogs to scroll vertically. Following some online example, I added a vertical scroll bar, and the appropriate message and handler to deal with vertical scrolling.

The scroll bar itself behaves perfectly, changing it's position when I click on it or drag it. My dialog however remains static and doesn't scroll.

To isolate the problem, I modified the scroll message handler and hard-coded a ScrollWindow() command whenever a scroll occurs, like so:

void SettingsDialog::OnVScroll(UINT nSBCode, 
    UINT nPos, CScrollBar* pScrollBar)
{
    ScrollWindow(0,30,NULL,NULL);
}

The code is reached, but still no scrolling occurs in my dialog. Can anyone shed some light on this mystery?

By the way, i've found a thread on Coding Guru which discusses the exact same problem, but has not been resolved here: http://www.codeguru.com/forum/showthread.php?t=54304

Upvotes: 2

Views: 2277

Answers (2)

DD
DD

Reputation:

MSDN says this... !

Note The ScrollWindow function is provided for backward compatibility. New applications should use the ScrollWindowEx function.

http://msdn.microsoft.com/en-us/library/bb787591(VS.85).aspx

Upvotes: 1

BitBank
BitBank

Reputation: 8715

I've run across the same problem. I never use MFC, but the Win32 function to make it work correctly is this:

         ScrollWindowEx(hDlg, 0, currentPos - si.nPos, NULL, NULL, NULL, NULL, SW_SCROLLCHILDREN | SW_INVALIDATE);

Upvotes: 3

Related Questions