Solved

CSliderCtrl caluclate Mouse click to Position

Posted on 2009-04-11
3
1,393 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

622 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