 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
majkinetor
Joined: 24 May 2006 Posts: 4511 Location: Belgrade
|
Posted: Mon Aug 31, 2009 5:11 pm Post subject: [function] Attach 1.1 |
|
|
NOTE: Latest Attach is in the Forms framework.
_________________

Last edited by majkinetor on Mon Jan 17, 2011 6:24 pm; edited 11 times in total |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4652 Location: AHK Forum
|
|
| Back to top |
|
 |
toralf n-l-i Guest
|
Posted: Mon Aug 31, 2009 7:32 pm Post subject: |
|
|
Hi majkinetor,
That looks interesting. What are the advantages over Anchor()?
regards
toralf |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4511 Location: Belgrade
|
Posted: Mon Aug 31, 2009 8:32 pm Post subject: |
|
|
Hey mate, good to see you again here.
| torlaf wrote: | | What are the advantages over Anchor()? |
- It can correctly reset , which was one of the reasons to do it.
- It can work with container controls so it allows for kind of multidimensional anchoring. When I release Panel control you will be able to use this function to attach controls inside it.
- It has p parameter for proportional following.
- It has delayed redrawing (r2).
- Its faster, especially with larger number of controls as it always sets things in 1 function call, it cashes dll call entry points, use "assume static" instead NumGet/Put for storage etc...
- You can enable/disable function for control. This can be used, for instance, for invisible controls so they are not being attached while in hidden state.
- Different modules can use it simultaneously as it doesn't require GuiSize to be set.
- Designed for highly dynamic window scenarios in mind.
- On the minus side, you can't feed controls AHK names, only handles are supported (intentiously tho, I mostly don't use control names as they are global) _________________

Last edited by majkinetor on Mon Aug 31, 2009 10:33 pm; edited 9 times in total |
|
| Back to top |
|
 |
n-l-i-d Guest
|
Posted: Mon Aug 31, 2009 9:03 pm Post subject: |
|
|
majkinetor is on a coding spree!
 |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4511 Location: Belgrade
|
Posted: Mon Aug 31, 2009 9:31 pm Post subject: |
|
|
I am actually polishing my previuosly unreleased work, inspired by recent AHK changes made mostly by Lexikos.
Expect many more goodies soon. _________________
 |
|
| Back to top |
|
 |
jballi
Joined: 01 Oct 2005 Posts: 747 Location: Texas, USA
|
Posted: Mon Aug 31, 2009 9:52 pm Post subject: |
|
|
Looks like another winner. Thanks.  |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4511 Location: Belgrade
|
Posted: Mon Aug 31, 2009 10:46 pm Post subject: |
|
|
Small bug with reseting of disabled hidden controls fixed.
Please re-download. _________________
 |
|
| Back to top |
|
 |
freakkk
Joined: 29 Jul 2005 Posts: 179
|
Posted: Tue Sep 01, 2009 1:10 am Post subject: |
|
|
| n-l-i-d wrote: | | majkinetor is on a coding spree! |
| majkinetor wrote: |
I am actually polishing my previuosly unreleased work, inspired by recent AHK changes made mostly by Lexikos.
| F*ing A!!
| majkinetor wrote: | When I release Panel control you will be able to use this function to attach controls inside it.
|
| majkinetor wrote: | | Expect many more goodies soon. | I can't wait!  _________________ .o0[ corey ]0o. |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4511 Location: Belgrade
|
Posted: Wed Sep 16, 2009 12:20 pm Post subject: |
|
|
*** version 1.01 ***
! Fix for reset on non-triggered WM_SIZE on Gui, Show when it was preceded by Gui, Show, Hide without autosize.
This fix is required when using controls that require window dimensions to be set in advance (Toolbar, Rebar..) or in any other scenario that requires that, and you later showed the window using simply Gui, Show without using Autosize. Example:
| Code: |
Gui, +LastFounds +Resize
hGui := WinExist()
Gui, Show, w400 h500 Hide
Gui, Add, Edit, HWNDhEdt1,
Gui, Add, Button, HWNDhBtn1, Top
Gui, Add, Button, HWNDhBtn2, Bottom
Gui, Add, MonthCal, HWNDhCal
Align(hEdt1, "Left")
Align(hBtn1, "Top")
Align(hBtn2, "Bottom")
Align(hCal, "Fill")
Attach(hEdt1, "h")
Attach(hBtn1, "w")
Attach(hCal, "w h")
Attach(hBtn2, "y w")
Gui, Show ; , Autosize
return
F1::
WinHide, ahk_id %hBtn2%
WinHide, ahk_id %hEdt1%
Align(hGui) ;re-align
Attach() ;reset attach
return
|
This code first creates Gui , then adds controls, then calls the function that allign controls to the window (so it reqiures to know window size) then it shows the Gui without autosize.
Unless you specify autosize, last Gui, Show never triggers WM_SIZE message (and consequently, Attach fails to initialize window size)
This is not the problem unless you immediately reset Gui without changing the placement of the window (rare situation, but again, bug). If you resizesd window previously it would work. So above code would scramble controls if you pressed F1 on startup. _________________
 |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4511 Location: Belgrade
|
Posted: Thu Sep 17, 2009 6:48 pm Post subject: |
|
|
*** version 1.02 ***
! Resetting before adding any control would make function unusable. _________________
 |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4511 Location: Belgrade
|
Posted: Tue Sep 29, 2009 9:35 am Post subject: |
|
|
*** version 1.04 ****
+ "-" can now be used in attach definition string to set-up control as initially disabled.
* "p" now doesn't have to be used as the first option.
! Bugfix for container controls. "Attach_" can be used now as WM_SIZE handler for any control that need to attach its children.
! Small bugfix with reseting. _________________
 |
|
| Back to top |
|
 |
hughman
Joined: 11 Feb 2007 Posts: 166
|
Posted: Tue Sep 29, 2009 11:53 am Post subject: |
|
|
| Quote: | | When I release Panel control you will be able to use this function to attach controls inside it. |
wow, I want to know when you release Panel control. I long for it all the time. |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4511 Location: Belgrade
|
Posted: Tue Sep 29, 2009 6:30 pm Post subject: |
|
|
The control is already developed. I'll release it when I finish all the tests I have in mind (which is quite a lot, so it will take some time). _________________
 |
|
| Back to top |
|
 |
ImNoob@This Guest
|
Posted: Tue Oct 06, 2009 10:54 pm Post subject: |
|
|
Pardon my ignorance, but I've been trying a while and I'm not the best at this sort of thing.
I'm trying to use this to Attach an emeded Firefox. I'm looking to replace what I used to use: Anchor("AtlAxWin1", "wh").
| Code: | | PWB := COM_AtlAxGetControl(COM_AtlAxCreateContainer(Gui_1_ID, 0, 25, 870, 375, "Mozilla.Browser")) |
I've tried to get the HWND of the embedded Firefox using:
| Code: | | ControlGet, Handle, Hwnd,, AtlAxWin1, Example_Window |
| Code: | | ControlGet, Handle, Hwnd,, PWB, Example_Window |
... Etc. Like I said, pardon my ignorance.
Thank you for your time. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|