CScrollView suddenly stopped scrolling
Richard. L. Chen -- torus@ms3.hinet.net Tuesday, December 10, 1996 Environment: VC++1.52c, Win 95 I have a CSCrollView program (SDI) that suddenly stopped scrolling. Everything else seemed all right. The view was painted and scroll bars appeared. Does anyone have similar experience and can give me a hint on what could have happened? Thanks, Richard L. Chen
Daniel Munoz -- dmunoz@socabim.fr Friday, December 13, 1996 Environment: VC++ 4.2, Win 95, NT 3.51, NT 4.00 This seem to be the famous 16bit limit for ScrollBars messages when tracking a bar. If the size of your view is superior to 32767, it could be. if you have MSDN, an article explain this ugly limit: take a look to article "Scroll Bar Controls in Win32" here's a little part that explain the limitation: -------------------------------->8----------------------------------------- ---------------------------------------->8---------------------------------- ---------------------- Limitations In Win32, 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 (Figure 3). -------------------------------->8------------------------------------------ --------------------------------------->8----------------------------------- --------------------- Hope that help. Daniel Munoz dmunoz@socabim.fr
Paul Martinsen -- pmartinsen@hort.cri.nz Tuesday, December 17, 1996 Environment: VC++ 4.0, Win 95 > > This seem to be the famous 16bit limit for ScrollBars messages when > tracking a bar. > If the size of your view is superior to 32767, it could be. Is it true that we can get around this by using GetScrollInfo to get the current scroll bar position (even in Win '95)? I suspect this could be the case if it is only the scroll messages that are limited to 16-bits, and not the internal scroll code. Paul. Paul Martinsen. --------------------------------------------------------------- PhD Student. p.martinsen@auckland.ac.nz Deparment of Electrical and Electronic Engineering University of Auckland. Hort+Research Private Bag Ruakura Research Centre Auckland Hamilton. New Zealand New Zealand. ---------------------------------------------------------------
Mike Blaszczak -- mikeblas@nwlink.com Tuesday, December 17, 1996 [Mini-digest: 2 responses] At 09:19 12/17/96 +1200, Paul Martinsen wrote: >Is it true that we can get around this by using GetScrollInfo to get >the current scroll bar position (even in Win '95)? Yes. >I suspect this could be the case if it is only the scroll >messages that are limited to 16-bits, and not the internal >scroll code. Unfortunately, the way that MFC handles these messages must be compatible with broken code that people sometimes write. MFC 4.1 (I think) had support for the extended ranges, but too many people write code that fires off fake WM_HSCROLL and WM_VSCROLL messages. That makes it impossible for MFC to reliably process the messages for you, and that means we have to leave it to the developer to write their own code when they can be sure that it's appropriate to do so. .B ekiM http://www.nwlink.com/~mikeblas/ <-- trip report central! 95 Honda VFR-750F / 88 Yamaha FZ-700 (damaged) / 94 Mazda RX-7 Serial #00050! / AMA - HRC - VFROC / Wang Dang Wankel I am bored of this talk. It is time now for the dancing! These words are my own - I do not speak on behalf of Microsoft. -----From: "Richard L. Chen"Thanks for information about 16-bit scroll sizes. However, I am afraid that I did not make my point clear enough. The scroll sizes I was using were decent integers. I got everything right on the screen, except that SCROLL BARS DID NOT RESPOND TO MOUSE CLICKS. The application did not hang; other functions kept working smoothly. I got this problem after making minor modifications to some command message handlers and rebuilding the program. I would say that I was quite innocent and did not tamper around. I am looking for similar experiences to get hints on what could have happened. Best regards, Richard L. Chen Daniel Munoz wrote: > > Environment: VC++ 4.2, Win 95, NT 3.51, NT 4.00 > > This seem to be the famous 16bit limit for ScrollBars messages when > tracking a bar. > If the size of your view is superior to 32767, it could be. > if you have MSDN, an article explain this ugly limit: > > take a look to article "Scroll Bar Controls in Win32" > > here's a little part that explain the limitation: > > -------------------------------->8----------------------------------------- > ---------------------------------------->8---------------------------------- > ---------------------- > Limitations > In Win32, 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 (Figure 3). > -------------------------------->8------------------------------------------ > --------------------------------------->8----------------------------------- > --------------------- > > Hope that help. > > Daniel Munoz > dmunoz@socabim.fr >>Environment: VC++1.52c, Win 95 >>I have a CSCrollView program (SDI) that suddenly stopped scrolling. >>Everything else seemed all right. The view was painted and scroll bars >>appeared. >>Does anyone have similar experience and can give me a hint on what >>could have happened? >>Thanks, >>Richard L. Chen
Hector Fabio RESTREPO -- restrepo@lslsun.epfl.ch Friday, December 20, 1996 Hello, = About the scrollview problem, I think the information at this address can help some people. http://www.microsoft.com/kb/articles/q152/2/52.htm there you can found a sample code to solve the problem. I don't put all the text because I don't know if it is possible ( I mean copyright problems ) =A91996 Microsoft Corporation ---------------------------- Knowledge Base How To Get 32-bit Scroll Position During Scroll Messages Article ID: Q152252 = Creation Date: 08-JUN-1996 Revision Date: 12-JUN-1996 = The information in this article applies to: = The Microsoft Foundation Classes (MFC), = included with: Microsoft Visual C++, 32-bit Edition,versions 2.0, 2.1, 2.2, 4.0, 4.1 = SUMMARY = The current scroll bar position accompanying the SB_THUMBTRACK and SB_THUMBPOSITION type of scroll messages is only 16-bits wide. Functions such as GetScrollPos, SetScrollPos, GetScrollRange, and SetScrollRange can handle 32-bit value scroll-box positions. This article discusses how the GetScrollInfo call can be used to retrieve 32-bit scroll position during scroll messages. = -- = Hector Fabio RESTREPO Ecole Polytechnique Federal de Lausanne Laboratoire de Systemes Logiques email: restrepo@lslsun.epfl.ch
| Вернуться в корень Архива |