Scroll limitation issue

hi,

I have recently taken over the a project for someone, one of the issues we have come across is that you cant view an entire document, in a window with scroll bars if its really big.  I track this problem down to the ranges on the scroll bars.  Once the range of the scroll bar exceeds 32000 pixels, it is set, by my ex-colleague back to 32000.  So when you view a document, depending on the zoom factor you may only see a fraction of the document (until you let the zoom, zoom out to say 25% and you can see the whole document but its obviously too smal.  So easy fix I  thought just not have that reset in there...wrong.  Now you can scroll fine but when you get a certain way down the scroll bar, this is holding the scrolling tab, it stops, the document is reset to the top, and when you let go off the tab, it returns to the top too.  However if u use the arrows, it is fine, or click in the empty space on the scroll bar below the scrol tab then it will go to the end for you,  I am so confused on this one, it doesnt make any sense to me.  One why it wont work and two why some one would put a limit on it, presumably one is to avoid the other but this doesnt make a great deal of sense to me!

any ideas people

thanks

Will



Answer this question

Scroll limitation issue

  • Dave Gelowitz

    Yes! This is an error in my eyes. The coordinate calculation must represent the real numbers and not some mystic limitations to 16bit.

  • jjbutler88

    ok, but how is that going to solve the issue I have,

    I can still scroll a large part of the document upto 69606, but, i cant use the scroll box to do it, i have to use the arrows, pgup and down, or click in the empty space of the scroll bar to get it to 'jump' to my position.  In addition when i zoom into my document more and more of the bottom of it gets cut-off, it seems there is some sort of finite drawing area i can only have so many pixels

    Thanks for your help on this

    Will

  • Jon Langdon

    Could not agree more, so i took out these limitations. and a blank screen appeared in the window, nothing displayed at all...then i looked into the whole setwindowex and SetViewportExt methods and found that they were limited to 16-bit, but there was something to overcome this called SetViewportExtEx and SetWindowExtEx, but same problem occured.

    Then I said to set the horizontal and vertical values for these two methods too actual page size, but still nothing, blank page, whats your understanding of these two methods   The viewport one, mentions that if an error occurs it is rest to 0,0 horizontal and vertical co-ordinates, which may explain my document reverting right to the top, however upon a check on this method it worked fine.

    Any ideas

    Thanks

    Will

  • Gregg Payne

    I have the whole setscrollinfo function working but that same problem still persists

    this is wierd

    Will

  • Jeffrey Liu

    CScrollView itself should handle the case of ranges greate than 0xFFFF
    What happens to you application if you remove this limitation.

    Does the scrollbar reflect the original size
    What happens if you say ir doesn't work

    Again: You have to do nothing to handle scrol bar ranges with CScrollView > 16bit!



  • Leon Han

    I'm confused if the WM_VSCROLL and WM_HSCROLL messages always use getscrollpos, which returns a 32 bit range, then surely i dont need to do anything.

    As I said my predecessor limited the range to 32,000, with simeple code like

    if (y_range > 32000)
    {
       y_range = 32000;
    }

    Its a self imposed restrictions, but if the getscrollpos method always returns a 32 bit range then cant I simply take out this restriction   I cant because this doesnt work, so i assume i use the setscrollpos and getscrollpos methods, but when, they seem to use a structures in order to operate   I'm confused as to the purpose of these methods/how they actually work and how to implement them

    Thanks

    Will

  • Lyle Bullock

    No! Even the VC6 version of the MFC (MFC 4.2) is already using SetScrollInfo!
    The code for this can be found in the function CScrollView::UpdateBars!

    The message handlers for WM_VSCROLL and WM_HSCROLL do not use the position value in the message, they always use GetScrollPos. This function also returns a 32bit value.

    AFAIK there should be no problem with a 32bit range when using CScrollView!

  • KimMPS

    when u mentioned device co-ordinates that got me thinking and i found the following code, as it reads to me, this would not prevent my issue, but i think you might find an error in it

    the name of this function is prepare_dc (CDC dc)

    if ( CS_OBJECT::output_type == OUTPUT_PRINTER )

    {

    get_layers().m_printer_data.prepare_dc (dc);

    return;

    }

    if ( CS_OBJECT::output_type == OUTPUT_METAFILE )

    return;

    dc.SetMapMode (MM_ISOTROPIC);

    if(!dc.IsPrinting())

    {

    CSize wsize = m_zoomer.get_wext();

    if ( wsize.cx > 32000 )

    wsize.cx = 32000;

    if ( wsize.cy > 32000 )

    wsize.cy = 32000;

    dc.SetWindowExt ( wsize);

    CSize size = m_zoomer.get_vport();

    if ( size.cx > 32000 )

    size.cx = 320000;

    if ( size.cy > 32000 )

    size.cy = 320000;

    dc.SetViewportExt(size);

    }

    }


  • WilliamMandel

    But than you do not have a problem with the scroll range being limited to 16bit. This values is beyond 16bit!

    Debug into the code and see if you translation of the maximum scrollrange is truncated by some device coordinates calculations.


  • Matthew Hunter

    if I remove this limitation, the scroll works fine, you can press the arrows, etc and use the scroll bar as you would normally, BUT, when you click on the scroll bar itself and move it, whilst holding down the left mouse, then when you get about half the way down, from the top, the stuff i am scrolling resets itself to the top, and when you release the bar it,doesnt appear where you left it but at the top,

    this has been the only problem the whole time

    Will

  • PeteDev1

    ok, i might have something here, but need your expertise to verify   Is there a limit to which windows can draw.  Somebody has mentioned to me that i might be going beyond the extent of the windows canvas   Is there a limit to this   I know that programs like MSWord can have documents hundreds of pages long, but maybe they get round this by having a canvas for every ten pages or something like that.  The limitations on that prevent my document from being drawn any bigger, seem to be the issue.  So if i zoomed into a document, the size in say pixels of that document would increase even though i could only see a part of it, which explains why the bottom of my document is cut-off something i originally attributed to the scroll bar.

    On the other hand.

    I think its safe to say that my scroll bar is not limited to 16-bit, because i can in fact scroll all the way down my document, i just cant do it by holding the scroll bar and moving it, which would seem to disprove my above arguement.  I'm really confused on this

    Will

  • Rob1010

    Hey,

    Thanks for your response, I knew it was far too limiting.  However...The view I am using uses CScrollView, and therefore the way the scroll bar limits are set is with a call to SetScrollSizes.  This appears to have the limitation, is there a way around this, or will I have to change the view entirely


    Thanks

    Will

  • wolfman-x

    and my range doesnt seem to be able to go any further than 69606 on the y

    will

  • ChuaWenChing

  • Scroll limitation issue