Jump to content

Logical position


Recommended Posts

I want to create a custom slider but seems I have some troubles with calculate coordinate from a logical position and then calculate from coordinate a logical position. To understand better I attached 2 images:

Let's say slider start at (105,100) and finish at (290,100):

Case#1:

Posted Image

Case#2:

Posted Image

In case#2 seems to work this formula but just when logical values are positives.

For example: min=0 and max=10

105+(290-105)/(10-0)*x
Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

It's a simple ratio.

In case #1, you have the proportion:

((x - 105) / (290 - 105)) = ((0 - (-10)) / (10 - (-10)))

which gives that (x - 105) = ((0 - (-10)) / (10 - (-10))) * (290 - 105)

reducing to x - 105 = (10 / 20) * 185 = 185 / 2 = 92.5

hence x = 105 + 92.5 = 197.5

In case #2 you have another equation to solve:

((197.5 - 105) / (290 - 105)) = (((x - (-10)) / (10 - (-10)))

giving that ((197.5 - 105) / (290 - 105)) * (10 - (-10)) = (x - (-10))

reduces to (92.5 / 185) * 20 = (1 / 2) * 20 = x + 10

hence x = 20 / 2 - 10 = 0

Is that clear now?

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...