Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Automatically resize script on resolution change.



  • Please log in to reply
11 replies to this topic
Snipershot
  • Members
  • 19 posts
  • Last active: Apr 26 2014 12:30 PM
  • Joined: 02 Nov 2012

Hi Guys, 

 

I wrote a script in 1920x1080p resolution, but working in lower resolutions cuts off some part of my GUI. Is there a way to detect the system resolution (Sysget) and autofit a gui inside the resolution chosen?? Thanks in advance.



uname
  • Members
  • 194 posts
  • Last active: Oct 17 2015 08:46 AM
  • Joined: 13 Jun 2012
OnMessage(0x7E, "AutofitGui")

AutofitGui(w, l) {
    MsgBox % "new monitor resolution: "
        . l & 0xffff "x"
        . (l >> 16) & 0xffff
    ; resize code here
}


Snipershot
  • Members
  • 19 posts
  • Last active: Apr 26 2014 12:30 PM
  • Joined: 02 Nov 2012

Thanks man, but what would be this resize code?

For instance, I have a button at w1300, but it wont appear in a 1024x768 monitor. Thats what I would like to. A code to fit all outside GUI controls. Its because I will install and run the script in many diffent kind of machines, so I need to detect the current resolution and the script would fit all controls inside. Is it possible or have I to set control values for each resolution? 

 

Or at least, vertical and horizontal bars to scroll and view the offscreen content..



flyingDman
  • Spam Officer
  • 2186 posts
  • Last active: Nov 07 2015 08:15 AM
  • Joined: 27 Feb 2009

Look into using anchor.ahk


Marine Corps Gen. Joseph Dunford told senators at his Joint Chiefs of Staff confirmation hearing : “If you want to talk about a nation that could pose an existential threat to the United States, I'd have to point to Russia. And if you look at their behavior, it's nothing short of alarming.”


Snipershot
  • Members
  • 19 posts
  • Last active: Apr 26 2014 12:30 PM
  • Joined: 02 Nov 2012

I tried it. One problem o first try. When I maximize the window the listview increases its width to a not proportional measure. If I restore the window, everything goes back to normal, but when maximize again in messes with my listview width. My script starts maximized so it already starts messed. Any suggestion?

 

I am using: 

----------

Guisize:
Anchor("Lv1"   , "xw h", " 0 , 1 ,     , 1   ")
return
---------------------


flyingDman
  • Spam Officer
  • 2186 posts
  • Last active: Nov 07 2015 08:15 AM
  • Joined: 27 Feb 2009

try

Anchor("LV1", "wh")

Marine Corps Gen. Joseph Dunford told senators at his Joint Chiefs of Staff confirmation hearing : “If you want to talk about a nation that could pose an existential threat to the United States, I'd have to point to Russia. And if you look at their behavior, it's nothing short of alarming.”


Snipershot
  • Members
  • 19 posts
  • Last active: Apr 26 2014 12:30 PM
  • Joined: 02 Nov 2012

Tried. But now the function do not work when resizing. It starts maximized correctly, but when I resize nothing happens. I was using a modified version of Anchor, replace by original one.



flyingDman
  • Spam Officer
  • 2186 posts
  • Last active: Nov 07 2015 08:15 AM
  • Joined: 27 Feb 2009

Can you post your script?


Marine Corps Gen. Joseph Dunford told senators at his Joint Chiefs of Staff confirmation hearing : “If you want to talk about a nation that could pose an existential threat to the United States, I'd have to point to Russia. And if you look at their behavior, it's nothing short of alarming.”


Snipershot
  • Members
  • 19 posts
  • Last active: Apr 26 2014 12:30 PM
  • Joined: 02 Nov 2012

Here, thanks for helping! Using Anchor 4.60a - Lastest version.




Snipershot
  • Members
  • 19 posts
  • Last active: Apr 26 2014 12:30 PM
  • Joined: 02 Nov 2012

Guess I found the problem ... was usinh 64 bit version of ahk. Chaged to ansi 32 and looks like its working now... will check deeply



flyingDman
  • Spam Officer
  • 2186 posts
  • Last active: Nov 07 2015 08:15 AM
  • Joined: 27 Feb 2009

That is a big (and good looking) gui. As most of the controls will need to be subject to Anchor, it will take some time to get it right.  But it  can be done!. Here is an example of how 3 list boxes move together to fill the window.  The trick is to get the coefficients right.

#singleinstance force
gui, +resize
gui, add, listview, w200 r20 vLV1, a|b|c
gui, add, listview, x+10 w300 r20 vLV2, a|b|c
gui, add, listview, x10 y+10 w510 r10 vLV3, a|b|c
gui, show, hide ,test 
WinWait, test
gui, show, maximize ,test 
gui, show, ,test 
return

Guisize:
Anchor("LV1", "w.4h.66")
Anchor("LV2", "x.4w.6h.66")
Anchor("LV3", "y.66wh.33")
return

Marine Corps Gen. Joseph Dunford told senators at his Joint Chiefs of Staff confirmation hearing : “If you want to talk about a nation that could pose an existential threat to the United States, I'd have to point to Russia. And if you look at their behavior, it's nothing short of alarming.”


Snipershot
  • Members
  • 19 posts
  • Last active: Apr 26 2014 12:30 PM
  • Joined: 02 Nov 2012
✓  Best Answer

Thanks a lot for the help. I will have a lot of work, but now I know it is possible.!! ;)