1

I reckon I've found a bug in MFC class CPreviewView and just want to see if anyone else has it. When generating a preview for a document with 2 or more pages, and the 2-page preview 'mode' is set, the scrollbars are set as if it was the 1-page preview. This means that for a 2-page document (say) (again showing in 2-page preview mode) that the scroll bars are shown (they shouldn't) and the user can scroll down to "page 3" and p1 is then regenerated.

I think the problem lies in viewprev.cpp around L393:

m_nPages = m_pPreviewInfo->m_nNumPreviewPages;
if (m_nPages == 0)
    m_nPages = 1;
else if (m_nPages > m_nMaxPages)
    m_nPages = m_nMaxPages;     // Sanity Check!

m_nZoomOutPages = m_nPages;

SetScrollSizes(MM_TEXT, CSize(1, 1));   // initialize mapping mode only

if (m_pPreviewInfo->GetMaxPage() < 0x8000 &&
    m_pPreviewInfo->GetMaxPage() - m_pPreviewInfo->GetMinPage() <= 32767U)
{
    SCROLLINFO info;
    info.fMask = SIF_PAGE|SIF_RANGE;
    info.nMin = m_pPreviewInfo->GetMinPage();
    info.nMax = m_pPreviewInfo->GetMaxPage();
    info.nPage = 1;
    if (!SetScrollInfo(SB_VERT, &info, FALSE))
        SetScrollRange(SB_VERT, info.nMin, info.nMax, FALSE);
}
else
    ShowScrollBar(SB_VERT, FALSE);      // if no range specified, or too
                                        // large don't show

Surely this excerpt should have:

info.nMax = m_pPreviewInfo->GetMaxPage() - (m_nPages - 1) ;

instead.

Is the solution to derive my own and override this function as per https://msdn.microsoft.com/en-us/library/aabc3hc6.aspx#sthash.aKlh2DG4.dpuf?

Thanks!

2
  • What version of MFC are you using? Commented Nov 23, 2015 at 1:46
  • Silly of me not to include - VS2013 so MFC 12 Commented Nov 23, 2015 at 2:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.