Page 3 of 6

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

Posted: 26 Apr 2015, 07:47
by danielo515
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

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

Posted: 26 Apr 2015, 12:10
by toralf
Actually I think it is simple.
What would you suggest should change?

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

Posted: 27 Apr 2015, 03:51
by danielo515
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

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

Posted: 27 Apr 2015, 06:21
by Guest
Only the first one works as expected.
Dont know if its my fault, but it drives me crazy.

Code: Select all

	html:="fadfsf dfsdf  dfssdf dfsd fsdf fsd fsdf fsdf df dfsd fd f sdf dsf asf  fsdf f sdfsd f"
	
	Gui,  +Resize 
	document1 := ComObjCreate("InternetExplorer.Application")
	Gui,  Add, ActiveX,  h100 w100  vdocument1 hwndhTest1, HTMLFile
	document1.write(html)
	Gui,  Show, x800, test1
	
	Gui, web:new
	Gui, web:Default
	Gui,  +Resize 
	document2 := ComObjCreate("InternetExplorer.Application")
	Gui,  Add, ActiveX,   h100 w100  vdocument2 hwndhTest2, HTMLFile
	document2.write(html)
	Gui,  Show, x1000, test2
	
	Gui, net:new
	Gui, net:  +Resize 
	document3 := ComObjCreate("InternetExplorer.Application")
	Gui,net:  Add, ActiveX,   h100 w100  vdocument3 hwndhTest3, HTMLFile
	document3.write(html)
	Gui, net: Show, x1300, test3
	return
	
	GuiSize:
	AutoXYWH("wh", htest1)
	AutoXYWH("wh", htest2)
	AutoXYWH("wh", htest3)
	Return

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

Posted: 27 Apr 2015, 06:47
by toralf
You will need to add WebGuiSize and NetGuiSize.
Each of the guisize subroutines will have only one AutoXYWH().

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

Posted: 27 Apr 2015, 07:43
by Guest
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.

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

Posted: 30 Apr 2015, 07:55
by danielo515
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?

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

Posted: 30 Apr 2015, 08:31
by tmplinshi
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

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

Posted: 30 Apr 2015, 10:42
by danielo515
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.

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

Posted: 12 May 2015, 23:43
by BGM
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

#include lib\autoxywh.ahk

Gui, +Resize
Gui, Add, Edit, HwndHEdit1,
Gui, Add, Edit, x+4 HwndHEdit2,
Gui, Add, Edit, x+4 HwndHEdit3,
Gui, Show
Return

GuiSize:
    AutoXYWH("w", HEdit1)
    AutoXYWH("xw", HEdit2)
 	AutoXYWH("xw", HEdit3)
Return

GuiClose:
ExitApp

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

Posted: 13 May 2015, 03:35
by tmplinshi
@BGM

Code: Select all

    AutoXYWH("w0.33", HEdit1)
    AutoXYWH("x0.33 w0.33", HEdit2)
    AutoXYWH("x0.66 w0.33", HEdit3)

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

Posted: 13 May 2015, 09:56
by BGM
Thanks! That gives me some ideas. I actually had read about using percentages but I didn't get it. Now I get it.

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

Posted: 16 May 2015, 10:43
by BGM
Hmmm... I was hoping to do some tricks with two edit controls.
Take a look at my example here:
http://ahkscript.org/boards/viewtopic.p ... 635#p45635
where I try to use GuiSize to size one edit control but not the other and vice versa.

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

Posted: 16 May 2015, 11:25
by toralf
Try to use the version which has the options as the first parameter and then a variadic list of controls.

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

Posted: 16 May 2015, 11:37
by BGM
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

	isdown := getkeystate("shift","P")
	if(isdown){
		autoxywh("w", "edit2")
	}else{
		autoxywh("x*", "edit2")
		autoxywh("w", "edit1")	
	}

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

Posted: 16 May 2015, 22:46
by toralf
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.

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

Posted: 17 May 2015, 11:32
by BGM
tmplinshi added a setting for resetting the control info: http://ahkscript.org/boards/viewtopic.p ... 768#p45733

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

Posted: 21 May 2015, 05:12
by m3user
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

Gui, +Resize
Gui, Add, Edit, ve1 w150 h100
Gui, Add, Button, vb1 gResize, Resize
Gui, Show		
return

Resize:
GuiControl, Move, e1, h50
AutoXYWH("update_ctrl_info")
return

GuiSize:
AutoXYWH("wh", "e1")		
AutoXYWH("y", "b1")		
return

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

Posted: 23 May 2015, 09:36
by BGM
In case anyone has been following my plight - Just Me solved my resizing procedure with some basic math (doh!) rather than using a library.

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

Posted: 28 May 2015, 20:32
by tmplinshi
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

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