#1
  1. It was not me!
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2005
    Location
    Brazil
    Posts
    738
    Rep Power
    104

    Window proportion calculation


    Hi,

    I am not sure if this is where this topic would fit in but please move it if it does not belong here... and sorry for the incovenience.

    My problem is the follow:

    I have a main window so lets say 1680x1050 wide... and inside it i have images and one of those images is another window.

    So lets says Main Window and Inner Window.

    The inner window would look like this (imaginary):

    The code tag will be in the example the Main Window
    Code:
    
    
            |---------------------------------------|
            | This is an inner window               |
            |---------------------------------------|
            |                                       |
            |                                       |
            |                                       |
            |                                       |
            |                                       |
            |                                       |
            |                                       |
            |                                       |
            |                                       |
            |           ____________________        |
            |          |  This is a button  |       |
            |          |____________________|       |
            |                                       |
            |                                       |
            |                                       |
            |                                       |
            |                                       |
            |                                       |
            |                                       |
            |                                       |
            |---------------------------------------|
    And i i variable that gives me that Inner Window Location X and Y and it is size W and H.

    OK so here it goes what i want to do...

    I want to be able to capture where the button inside that window is based the Inner Window Proportion and Size

    Something like for example:
    X16 + (W444*0.45)
    Y142 + (H560*0.45)
    So that would be the button location for example...

    But if i rezise it to 800x600 it would have a diff location so how could i probably stand this calculation to any kinda of window size considering i can have the Inner window Location and Size whenever the Main Window is resized ?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    May 2004
    Posts
    3,417
    Rep Power
    887
    This is pretty simple really. I think you can figure it out if you just add an imaginary vertical line centered on the inner window. Now for the vertical position, you'd have an imaginary horizontal line that is probably going to be some percentage of the inner window height, off the bottom or top of the inner window.

    Take you're little diagram and draw those imaginary lines. Think about it.
    I no longer wish to be associated with this site.
  4. #3
  5. It was not me!
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2005
    Location
    Brazil
    Posts
    738
    Rep Power
    104
    Actually i was thinking of it and in the example i gave it does work with those calculation but if i change the window scale or size it won't hit the nail as i wanted ...

    so for example:
    X = InnerWindowX+(InnerWindowWidth * 0.50)
    Y = InnerWindowY+(InnerWindowHeigth * 0.62)

    but if i have a "scale size" for that given Main Window size then i am not sure on how to approch it ... the scale sizes goes from 1.00 to 0 so you have 0.99, 0.98 and so forth and they all mess up with the button size and innerwindow size...

    But the only thing i can rely on is the InnerWindow size as i cannot know what scale size it is at the current momment
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    May 2004
    Posts
    3,417
    Rep Power
    887
    Originally Posted by prixone
    but if i have a "scale size" for that given Main Window size then i am not sure on how to approch it...
    I have no idea what you mean by "scale size". You can always get the actual size of the window in question. What is this "scale size" and why do you think it matters? Are you referring to the dot pitch? I think you should do all your calculations in pixels and ignore the dots per inch.
    I no longer wish to be associated with this site.

IMN logo majestic logo threadwatch logo seochat tools logo