Solved

CSliderCtrl caluclate Mouse click to Position

Posted on 2009-04-11
3
1,373 Views
Last Modified: 2013-11-20
Hello,

I want to save in a csliderctrl a extended GetPos. This GetPosEx() will return the real position inside a trackbar of a CSliderCtrl.  To Set this I want to do this inside the OnLButtonClick where I have only the position of the mouselick. How to calculate the real position/value of the slider at this position. My Slider has 0-100 value.

Ocrana
0
Comment
Question by:Ocrana
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
StefanKittel earned 500 total points
ID: 24126996
Hello,

I'm not sure I got everything.
You wan't to calucalte the position of your silder from the absolut mouse position?

OK.
You got the mouse position
You need the top left position from your slider using GetWindowPos
You need the size from your slider using GetWindowPos
I'm not sure how to get the size of the knobs left and right. I'll use them as consts and get the size by a screenshot.

pos = mouse pox X * ((right - left - (2 * knob)) / 100)

Stefan
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 24132967
The specific answer depends on how you obtain the position of the mouse pointer.  The calculations will be different depending on if the location is expressed in screen-global or client-local coordinates.
0
 

Author Closing Comment

by:Ocrana
ID: 31569235
No finaly what I needed but helps me alot.
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to determine file rename from EventLog ? 2 58
conditional code and condition difference 9 84
lucky13 challenge 11 158
Access to class from any project within a solution. 6 33
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.

756 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