Solved

Vertical scrolling.

Posted on 2001-06-05
7
282 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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 200 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
configuration management 2 100
Host to IP 7 73
Separate files macro - Errors on larger data set 18 56
ORA-01403: no data found 43 82
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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 shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now