Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Vertical scrolling.

Posted on 2001-06-05
7
Medium Priority
?
298 Views
Last Modified: 2013-11-20
One of the parameters of CWnd::OnHScroll is nPos which Specifies the scroll-box position. In my application, the range that the scroller can be changed is very large. It can get over 100,000. The problem is that nPos is defined as UINT. In such cases, when I drag the slider over the 32,768 position, the nPos get garbage values.
Is there any way to overcome this annoying behaviour?
0
Comment
Question by:eyala
7 Comments
 
LVL 1

Expert Comment

by:AndreasF
ID: 6156814
As far as I know you can only set the range to the maximum possible and recalculate nPos with an algorithm like
nActualPosition = (nPos/32768)*100000;

Greetings
Andi
0
 
LVL 1

Expert Comment

by:guoching
ID: 6157475
Use GetScrollPos in CWnd::OnHScroll to get a 32-bit position.
0
 
LVL 1

Expert Comment

by:guoching
ID: 6157480
If you want to use the nPos, you can get the actual position by :
if(((int)nPos) < 0)      // nPos < 0 if over 32767
     x = 32767+(32767-((int)nPos));  
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:guoching
ID: 6157482
If you want to use the nPos, you can get the actual position by :
if(((int)nPos) < 0)      // nPos < 0 if over 32767
     nPos = 32767+(32767-((int)nPos));  
0
 

Author Comment

by:eyala
ID: 6158742
This only increase my range to 32767 * 2. I need much largr range than that. Is it possible?
0
 
LVL 3

Accepted Solution

by:
GlennDean earned 600 total points
ID: 6159284
To get the full 32-bit scroll position you have to use the GetScrollInfo function!
SCROLLINFO si;
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_RANGE;
GetScrollInfo(hwnd,SB_VERT,&si);
//Get the 32-bit scroll postion
int nPos = si.nPos;
0
 

Author Comment

by:eyala
ID: 6159761
thanks, you showed me the way, but I think more accurate way to do it is like this:

SCROLLINFO si;
si.fMask = SIF_ALL;
GetScrollInfo(SB_HORZ, &si);
nPos = si.nTrackPos;
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question