AutoXYWH() - Move control automatically when GUI resized

Post your working scripts, libraries and tools
danielo515
Posts: 58
Joined: 18 Feb 2015, 15:06

Re: AutoXYWH() - Move control automatically when GUI resized

26 Apr 2015, 07:47

Hello toralf,

It's not a problem with your script, it's a problem with AHK documentation. It's very hard to figure out that each window has it's ow guisize label. Once I added the name of the gui as a prefix of the guisize label you script started to work again. Not very intuitive in my opinion
toralf
Posts: 440
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: AutoXYWH() - Move control automatically when GUI resized

26 Apr 2015, 12:10

Actually I think it is simple.
What would you suggest should change?
ciao
toralf
danielo515
Posts: 58
Joined: 18 Feb 2015, 15:06

Re: AutoXYWH() - Move control automatically when GUI resized

27 Apr 2015, 03:51

toralf wrote:Actually I think it is simple.
What would you suggest should change?


Sorry if I was not clear. You script is working perfectly. What should be changed is AHK documentation.

Regards
Guest

Re: AutoXYWH() - Move control automatically when GUI resized

27 Apr 2015, 06:21

Only the first one works as expected.
Dont know if its my fault, but it drives me crazy.

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus

toralf
Posts: 440
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: AutoXYWH() - Move control automatically when GUI resized

27 Apr 2015, 06:47

You will need to add WebGuiSize and NetGuiSize.
Each of the guisize subroutines will have only one AutoXYWH().
ciao
toralf
Guest

Re: AutoXYWH() - Move control automatically when GUI resized

27 Apr 2015, 07:43

Thank you very much.
I knew that, but i totally forget that fact. And i read it in the docs but dont mention it. Not my day.
danielo515
Posts: 58
Joined: 18 Feb 2015, 15:06

Re: AutoXYWH() - Move control automatically when GUI resized

30 Apr 2015, 07:55

Hello Everyone.

This still not working for width of controls on the same "row". I tried with every kind of combination. Any Idea about what I'm doing wrong?
tmplinshi
Posts: 1100
Joined: 01 Oct 2013, 14:57

Re: AutoXYWH() - Move control automatically when GUI resized

30 Apr 2015, 08:31

danielo515 wrote:Hello Everyone.

This still not working for width of controls on the same "row". I tried with every kind of combination. Any Idea about what I'm doing wrong?

Note: Please use the modified version by toralf to test below examples.

Resize two controls's width at same row

Resize three controls's width at same row
danielo515
Posts: 58
Joined: 18 Feb 2015, 15:06

Re: AutoXYWH() - Move control automatically when GUI resized

30 Apr 2015, 10:42

Hello tmplinshi

Wow, I can't believe I have been so stupid! I have been using 0.5w and 0.5x as options instead of w0.5 and x0.5!!

Now I have others problems to face. Thank you.
User avatar
BGM
Posts: 389
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
Contact:

Re: AutoXYWH() - Move control automatically when GUI resized

12 May 2015, 23:43

In my case, I need three controls in a row to size proportionally, but I need the last control to be anchored to the previous control instead of anchored to "x".
In other words, in this case, Edit3's leftmost position should be 4 pixels from the rightmost edge of Edit2.
Is it possible to add a feature to anchor to another control's border?
Or maybe it could be made to anchor to the right side of the window?

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

tmplinshi
Posts: 1100
Joined: 01 Oct 2013, 14:57

Re: AutoXYWH() - Move control automatically when GUI resized

13 May 2015, 03:35

@BGM

Code: [Select all] [Download] GeSHi © Codebox Plus

    AutoXYWH("w0.33", HEdit1)
AutoXYWH("x0.33 w0.33", HEdit2)
AutoXYWH("x0.66 w0.33", HEdit3)
User avatar
BGM
Posts: 389
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
Contact:

Re: AutoXYWH() - Move control automatically when GUI resized

13 May 2015, 09:56

Thanks! That gives me some ideas. I actually had read about using percentages but I didn't get it. Now I get it.
User avatar
BGM
Posts: 389
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
Contact:

Re: AutoXYWH() - Move control automatically when GUI resized

16 May 2015, 10:43

Hmmm... I was hoping to do some tricks with two edit controls.
Take a look at my example here:
viewtopic.php?f=5&t=7696&p=45635#p45635
where I try to use GuiSize to size one edit control but not the other and vice versa.
toralf
Posts: 440
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: AutoXYWH() - Move control automatically when GUI resized

16 May 2015, 11:25

Try to use the version which has the options as the first parameter and then a variadic list of controls.
ciao
toralf
User avatar
BGM
Posts: 389
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
Contact:

Re: AutoXYWH() - Move control automatically when GUI resized

16 May 2015, 11:37

toralf - that's the autoxywh.ahk (not anchor)

; Release date: 2014-7-03
; Author : tmplinshi (mod by toralf)
; requires AHK version : 1.1.13.01+

I've played around with this for some time now (I've tried both versions of AutoXYWH). It looks like I'm going to have to do all the math myself.
AutoXYWH, for some reason, just doesn't seem to respect the settings - it's as if it conflicts with itself.

So I tried reversing things. In the following configuration, when you hold shift, none of the boxes resize at all.
It seems like autoxywh is ignoring the second declaration.
Further, if you shift+resize and then try to resize without shift, autoxywh doesn't respect the new size of the box.

Code: [Select all] [Download] GeSHi © Codebox Plus

	isdown := getkeystate("shift","P")
if(isdown){
autoxywh("w", "edit2")
}else{
autoxywh("x*", "edit2")
autoxywh("w", "edit1")
}
toralf
Posts: 440
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: AutoXYWH() - Move control automatically when GUI resized

16 May 2015, 22:46

It stores the initial control size and position relative to the GUI size. All further movements are depending on the new GUI size. You are right you can not switch between different options nor can you reset the initial size/position.
ciao
toralf
m3user
Posts: 107
Joined: 17 Jan 2014, 18:11

Re: AutoXYWH() - Move control automatically when GUI resized

21 May 2015, 05:12

Thank you very much tmplinshi for adding a reset option. I tried it with my basic example (below) and it works well. You should update the function on the first page, maybe you could consider using a simpler parameter like AutoXYWH("r")or even AutoXYWH().

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

User avatar
BGM
Posts: 389
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
Contact:

Re: AutoXYWH() - Move control automatically when GUI resized

23 May 2015, 09:36

In case anyone has been following my plight - Just Me solved my resizing procedure with some basic math (doh!) rather than using a library.
tmplinshi
Posts: 1100
Joined: 01 Oct 2013, 14:57

Re: AutoXYWH() - Move control automatically when GUI resized

28 May 2015, 20:32

I added a note about the 'reset' option to the first post.

Added the reset option, and changed the version info to:

Code: [Select all] [Download] GeSHi © Codebox Plus

; Version: 2015-5-29 / Added 'reset' option (by tmplinshi)
; 2014-7-03 / toralf
; 2014-1-2 / tmplinshi

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 14 guests