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

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


CScrollView problem...

Arun Kumar -- paks@arbornet.org
Tuesday, October 01, 1996

Hi All,

Environment : MSVC 4.0 , Windows 95


I am using CScrollView in my application, i have strange problem in =
diplaying=20
the file contents in view.
Problem: If the File size is greater than 2500 lines even though after =
setting=20
the scroll size using setscrollsizes member function , not all the =
contents are getting displayed(it's getting truncted abnormally).But if =
i do GetTotolSize() i am getting the scrollrange allocated. If File size =
is less than 2500 lines it's fine and no problem. To increse the scroll =
size i have optimized the OnDraw code to display only in client area.
Just i want to know whether any limitation on the CScrollView or any =
possible=20
mistakes i am doing. I have to  fix this problem as soon as possible  =
because we are in tight schedule.
	Expecting quick solution=20
					bye
						Arun.			=09





David Lowndes -- David.Lowndes@bj.co.uk
Thursday, October 03, 1996

[Mini-digest: 3 responses]

>Problem: If the File size is greater than 2500 lines even though after =
>setting=20
>the scroll size using setscrollsizes member function , not all the =
>contents are getting displayed

Arun,

You're more than likely running into the 32K pixel limit of CScrollView.
Check if 2500*LineHeight is >=32K.

If this is a major problem for you I'd abandon CScrollView (fighting it
is too much trouble) and implement the functionality you need
yourself in a CView derived class.

Dave Lowndes
-----From: "MHENRY.UMI.COM" 

Arun, 
 
I'm a little confused.  You say you display 2500 *LINES* of a file.  
CScrollView's settings is in device pixels of course (assuming you use 
MM_TEXT).  If each line is about 10 pixels, 10 * 2500 = 25,000, which is 
dangerously close to CScrollView's 32,000 device pixel limit.  The best 
solution is to roll your own scroll view...  assuming I have understood the 
problem. 
 
--matt 
/~~~~~~~~~~~~~~~~~~~~~~~~~~~  
  Matthew Henry  -- UMI            
  mhenry@umi.com     (Work)              
  mhenry1384@aol.com (Home)  
~~~~~~~~~~~~~~~~~~~~~~~~~~/  
-----From: ganeshs@nationwide.com

    Scrollbars do  have a limitation  on the  scroll range of  (I think)
32767. Now,assuming  each of  your lines  is about  13 units  high, that
would allow  for little more than  2500 lines. Solution? Write  your own
CScrollView! (see  Petzold for plain-vanilla-Windows-ideas that  you can
apply to MFC without too much effort...)

/ ___|    / ___| __ _ _ __   ___  ___| |    I do not speak for
\___ \   | |  _ / _` | '_ \ / _ \/ __| '_ \ Tata   Unisys   or
 ___) |  | |_| | (_| | | | |  __/\__ \ | | |Nationwide    Ins.
|____(_)  \____|\__,_|_| |_|\___||___/_| |_|------------------



John Bruno -- John_Bruno@ccm.jf.intel.com
Monday, October 07, 1996


Text item: 


Arun

If you search on MSDN for:  "Scroll Bar Controls in Win32", you will find a 
technical article by Nancy Winnick Cluts.  Athought this was origionally 
written about/for win32 the problem still exist in VC++ 4.x.

Basically CScrollView has a internal limit of 32K for dynamic scrolling,
so you need to manage it yourself.  You can use 32-bit values to set the 
range and position of the thumb in the scroll bar. However, if you are 
doing real-time thumb tracking using the SB_THUMBTRACK message, Win32 will 
give you only 16 bits of position data. This is because the position data 
is returned in the HIWORD of the lParam. To get around this limitation, you 
need to approximate the position yourself. One way to do this is to get the 
current cursor position, map it to the scroll window, and calculate the 
position based on the ratio between the mouse position in the scroll bar 
window and the point within the range of the scroll bar.  

I would think adding this fix/patch/hach would be easier that creating a 
CScrollView from scratch.

--

John Bruno john_bruno@ccm.jf.intel.com     
 _____________________________ Reply Separator _____________________________
Subject: Re: CScrollView problem...
Author:  owner-mfc-l@majordomo.netcom.com at SMTPGATE
Date:    10/3/96 9:23 AM


[Mini-digest: 3 responses]

>Problem: If the File size is greater than 2500 lines even though after = 
>setting=20
>the scroll size using setscrollsizes member function , not all the = 
>contents are getting displayed
     
Arun,
     


Text item: External Message Header

The following mail header is for administrative use
and may be ignored unless there are problems.

***IF THERE ARE PROBLEMS SAVE THESE HEADERS***.

Reply-To: mfc-l@netcom.com
Precedence: bulk
Errors-To: owner-mfc-l@majordomo.netcom.com
Sender: owner-mfc-l@majordomo.netcom.com
Subject: Re: CScrollView problem...
In-Reply-To: <01BBAFA8.A81C15C0@suhas.bflsl.soft.net>
To: mfc-l@netcom.com (Non Receipt Notification Requested)
Message-ID: <"Davi1003092544aa*/G=David/S=Lowndes/O=Boldon James Limited/PRMD=BJ
/ADMD=TMAILUK/C=GB/"@MHS>
X400-Content-Type: P2-1984 (2)
X400-MTS-Identifier: [/PRMD=bj/ADMD=TMAILUK/C=GB/;sparcone-m.747:03.10.96.08.23.
17]
X400-Recipients: mfc-l@netcom.com
X400-Originator: David.Lowndes@bj.co.uk
Date: Thu, 3 Oct 1996 09:23:18 +0100
X400-Received: by mta sparcone-mta in /PRMD=bj/ADMD=TMAILUK/C=GB/; Relayed;
               Thu, 3 Oct 1996 09:23:18 +0100
X400-Received: by mta gatekeeper.bj.co.uk in /PRMD=BJ/ADMD=TMAILUK/C=GB/;
               Relayed; Thu, 3 Oct 1996 09:28:36 +0100
From: David.Lowndes@bj.co.uk
Received: by majordomo.netcom.com (8.7.5/8.7.3/(NETCOM MLS v1.01)) id IAA29408;
Fri, 4 Oct 1996 08:35:44 -0700 (PDT)
Received: from majordomo.netcom.com (listless.netcom.com [206.217.29.105]) by ma
ilbag.jf.intel.com (8.7.6/8.7.3) with ESMTP id LAA22187; Fri, 4 Oct 1996 11:16:2
2 -0700 (PDT)
Received: from mailbag.jf.intel.com (root@mailbag.jf.intel.com [134.134.248.4])
by relay.jf.intel.com (8.7.4/8.7.3) with ESMTP id LAA27567; Fri, 4 Oct 1996 11:1
4:03 -0700 (PDT)
Return-Path: owner-mfc-l@majordomo.netcom.com



Kostya Sebov -- sebov@is.kiev.ua
Wednesday, October 09, 1996

>   [Mini-digest: 3 responses]
>
>   >Problem: If the File size is greater than 2500 lines even though after =
>   >setting=20
>   >the scroll size using setscrollsizes member function , not all the =
>   >contents are getting displayed
>
>   Arun,
>
>   You're more than likely running into the 32K pixel limit of CScrollView.
>   Check if 2500*LineHeight is >=32K.
>
>   If this is a major problem for you I'd abandon CScrollView (fighting it
>   is too much trouble) and implement the functionality you need
>   yourself in a CView derived class.
>
>   Dave Lowndes
>   -----From: "MHENRY.UMI.COM" 
>
>   Arun,
>
>   I'm a little confused.  You say you display 2500 *LINES* of a file.
>   CScrollView's settings is in device pixels of course (assuming you use
>   MM_TEXT).  If each line is about 10 pixels, 10 * 2500 = 25,000, which is
>   dangerously close to CScrollView's 32,000 device pixel limit.  The best
>   solution is to roll your own scroll view...  assuming I have understood the
>   problem.
>
>   --matt
>   /~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     Matthew Henry  -- UMI
>     mhenry@umi.com     (Work)
>     mhenry1384@aol.com (Home)
>   ~~~~~~~~~~~~~~~~~~~~~~~~~~/
>   -----From: ganeshs@nationwide.com
>
>       Scrollbars do  have a limitation  on the  scroll range of  (I think)
>   32767. Now,assuming  each of  your lines  is about  13 units  high, that
>   would allow  for little more than  2500 lines. Solution? Write  your own
>   CScrollView! (see  Petzold for plain-vanilla-Windows-ideas that  you can
>   apply to MFC without too much effort...)
>
>   / ___|    / ___| __ _ _ __   ___  ___| |    I do not speak for
>   \___ \   | |  _ / _` | '_ \ / _ \/ __| '_ \ Tata   Unisys   or
>    ___) |  | |_| | (_| | | | |  __/\__ \ | | |Nationwide    Ins.
>   |____(_)  \____|\__,_|_| |_|\___||___/_| |_|------------------
>

ScrollBars DO support ranges >32K (I assume Win32 of course). The culprit is
the GDI under Windows 95, which is still 16-bit.

Although CScrollView can be easily adapted to support long scroll ranges
(about three virtual overrides), this will only make it work under NT (I
tested it under 3.51 but I'm sure it'll work in 4.0). Under Win95 your
CScrollView::OnPrepareDC will break being unable to SetViewportOrg to a long
offset.

To overcome this problem and implement correct repainting you'll have to
forget OnPrepareDC and OnDraw, handle OnPaint directly and use only device
coordinates (as opposed to logical ones) having offset them to GetScrollPos.



--- 
Kostya Sebov. 
----------------------------------------------------------------------------
Tel: (38 044) 266-6387 | Fax: (38 044) 266-6195 | E-mail: sebov@is.kiev.ua



Linh Huynh -- lqhuynh@earthlink.net
Thursday, October 10, 1996

You can improve CscrollBar range by doing this:
in SB_THUMBPOSITION
   thumbposition = nPos & 0xffff 
it will make your scrollbar range upto 64k
I hope this help
----------
> From: Kostya Sebov 
> To: mfc-l@netcom.com
> Subject: Re: CScrollView problem...
> Date: Wednesday, October 09, 1996 11:52 AM
> 
> >   [Mini-digest: 3 responses]
> >
> >   >Problem: If the File size is greater than 2500 lines even though
after =
> >   >setting=20
> >   >the scroll size using setscrollsizes member function , not all the =
> >   >contents are getting displayed
> >
> >   Arun,
> >
> >   You're more than likely running into the 32K pixel limit of
CScrollView.
> >   Check if 2500*LineHeight is >=32K.
> >
> >   If this is a major problem for you I'd abandon CScrollView (fighting
it
> >   is too much trouble) and implement the functionality you need
> >   yourself in a CView derived class.
> >
> >   Dave Lowndes
> >   -----From: "MHENRY.UMI.COM" 
> >
> >   Arun,
> >
> >   I'm a little confused.  You say you display 2500 *LINES* of a file.
> >   CScrollView's settings is in device pixels of course (assuming you
use
> >   MM_TEXT).  If each line is about 10 pixels, 10 * 2500 = 25,000, which
is
> >   dangerously close to CScrollView's 32,000 device pixel limit.  The
best
> >   solution is to roll your own scroll view...  assuming I have
understood the
> >   problem.
> >
> >   --matt
> >   /~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >     Matthew Henry  -- UMI
> >     mhenry@umi.com     (Work)
> >     mhenry1384@aol.com (Home)
> >   ~~~~~~~~~~~~~~~~~~~~~~~~~~/
> >   -----From: ganeshs@nationwide.com
> >
> >       Scrollbars do  have a limitation  on the  scroll range of  (I
think)
> >   32767. Now,assuming  each of  your lines  is about  13 units  high,
that
> >   would allow  for little more than  2500 lines. Solution? Write  your
own
> >   CScrollView! (see  Petzold for plain-vanilla-Windows-ideas that  you
can
> >   apply to MFC without too much effort...)
> >
> >   / ___|    / ___| __ _ _ __   ___  ___| |    I do not speak for
> >   \___ \   | |  _ / _` | '_ \ / _ \/ __| '_ \ Tata   Unisys   or
> >    ___) |  | |_| | (_| | | | |  __/\__ \ | | |Nationwide    Ins.
> >   |____(_)  \____|\__,_|_| |_|\___||___/_| |_|------------------
> >
> 
> ScrollBars DO support ranges >32K (I assume Win32 of course). The culprit
is
> the GDI under Windows 95, which is still 16-bit.
> 
> Although CScrollView can be easily adapted to support long scroll ranges
> (about three virtual overrides), this will only make it work under NT (I
> tested it under 3.51 but I'm sure it'll work in 4.0). Under Win95 your
> CScrollView::OnPrepareDC will break being unable to SetViewportOrg to a
long
> offset.
> 
> To overcome this problem and implement correct repainting you'll have to
> forget OnPrepareDC and OnDraw, handle OnPaint directly and use only
device
> coordinates (as opposed to logical ones) having offset them to
GetScrollPos.
> 
> 
> 
> --- 
> Kostya Sebov. 
>
----------------------------------------------------------------------------

> Tel: (38 044) 266-6387 | Fax: (38 044) 266-6195 | E-mail: sebov@is.kiev.ua




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