AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[function] Attach 1.1
Goto page 1, 2, 3, 4  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Mon Aug 31, 2009 5:11 pm    Post subject: [function] Attach 1.1 Reply with quote

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
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 4652
Location: AHK Forum

PostPosted: Mon Aug 31, 2009 6:50 pm    Post subject: Reply with quote

Cool Cool

Thank you very much Wink
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
toralf n-l-i
Guest





PostPosted: Mon Aug 31, 2009 7:32 pm    Post subject: Reply with quote

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

PostPosted: Mon Aug 31, 2009 8:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
n-l-i-d
Guest





PostPosted: Mon Aug 31, 2009 9:03 pm    Post subject: Reply with quote

majkinetor is on a coding spree!

Cool
Back to top
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Mon Aug 31, 2009 9:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
jballi



Joined: 01 Oct 2005
Posts: 747
Location: Texas, USA

PostPosted: Mon Aug 31, 2009 9:52 pm    Post subject: Reply with quote

Looks like another winner. Thanks. Cool
Back to top
View user's profile Send private message Send e-mail
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Mon Aug 31, 2009 10:46 pm    Post subject: Reply with quote

Small bug with reseting of disabled hidden controls fixed.
Please re-download.
_________________
Back to top
View user's profile Send private message
freakkk



Joined: 29 Jul 2005
Posts: 179

PostPosted: Tue Sep 01, 2009 1:10 am    Post subject: Reply with quote

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!! Cool

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!   Very Happy
_________________
.o0[ corey ]0o.
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Wed Sep 16, 2009 12:20 pm    Post subject: Reply with quote

*** 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
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Thu Sep 17, 2009 6:48 pm    Post subject: Reply with quote

*** version 1.02 ***
! Resetting before adding any control would make function unusable.
_________________
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Tue Sep 29, 2009 9:35 am    Post subject: Reply with quote

*** 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
View user's profile Send private message
hughman



Joined: 11 Feb 2007
Posts: 166

PostPosted: Tue Sep 29, 2009 11:53 am    Post subject: Reply with quote

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
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Tue Sep 29, 2009 6:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
ImNoob@This
Guest





PostPosted: Tue Oct 06, 2009 10:54 pm    Post subject: Reply with quote

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
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group