15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


CScrollView

Will Lyons -- w.lyons@ccohs.ca
Tuesday, May 28, 1996

VC++ 1.52c Win3.1/95

I know that this has been discussed before but I would like to hear 
from people who have had this same common problem.

I have a CScrollView which I need to scroll more than 32767 logical 
units. We have used MM_LOENGLISH to maximize the scroll range but need to 
go beond what is available with MFC. I have had problems looking things 
up in the archive so I appologize for any inconvenience.



Dale Wilson -- dale@dra.com
Friday, May 31, 1996

[Mini-digest: 2 responses]

On Tuesday, May 28, 1996 9:48AM  asks:

> I have a CScrollView which I need to scroll more than 32767 logical
> units. We have used MM_LOENGLISH to maximize the scroll range but need to
> go beond what is available with MFC.

It is obvous that you don't have 32K lines of pixels on your screen (if you 
do, please let me know what type of screen you are using! (grin)), so 32K is 
MORE than enough resolution to manage the thumb position properly, so the 
question is really how can you manage the position in your data in response 
to scroll messages.

The HELP file for CScrollView starts by saying:

"You can handle scrolling yourself in any class derived from CView by 
overriding the message-mapped OnHScroll and OnVScroll member functions."

In other words, if CScrollView doesn't do what you want to do, either 1) 
don't use it, or 2)  use whatever capabilities are useful for you and 
override those functions which don't do what you want them to.

Dale@dra.com
-----From: Larry Siden 

I had to deal with the same issue when I wrote my first real MFC app, a hex dump
tool, which I did as my initiation to MFC.  Since the file to be dumped can be as
big as the disk will allow, CScrollView is totally inadequate.  What's more, I
didn't want to scroll in pixels, but in lines.  So I had to punt and handle the
WM_xSCROLL messages in my view class, derived from CView, not CScrollView.  In my
draw function, I always set the vertical window origin and viewport origin to be
identical, and figured out what needed to be redrawn according to the position of
the scroll bar.  

Even then, I was still not out of the woods with my implementation of vertical
scrolling, because the number of lines in a hex dump can still exceed 32K.  In case
that happens, I consider each tick of the scroll position to represent a multiple
number of lines.  The multiple is calculating by dividing the actual number of
lines by 32K and rounding up.

It wasn't very pretty, but that's what it took to get it to work right.

-- 
Larry Siden, Senior Software Engineer   phone: 313-930-9900 x211 (w)
Bio Image, Inc.                          fax:  313-930-0990
777 E. Eisenhower Pky, Suite 950        email: (w) lsiden@bioimage.com
Ann Arbor, MI   48108                          (h) Larry_Siden@msn.com



David.Lowndes@bj.co.uk
Tuesday, June 04, 1996

> Since the file to be dumped can be as big as the disk will allow,
CScrollView is totally inadequate.  What's more, I didn't want to scroll
in pixels, but in lines.
<

I've had to implement my own "home brew" line by line scroll view
as well. How about we all ask MS to add a CLineView class to MFC 5?




| Вернуться в корень Архива |