AutoHotkey Community

It is currently May 26th, 2012, 10:02 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 61 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: [function] Attach 1.1
PostPosted: August 31st, 2009, 6:11 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
NOTE: Latest Attach is in the Formsframework.


_________________
Image


Last edited by majkinetor on January 17th, 2011, 7:24 pm, edited 11 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2009, 7:50 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Cool 8)

Thank you very much ;)

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2009, 8:32 pm 
Hi majkinetor,

That looks interesting. What are the advantages over Anchor()?

regards
toralf


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2009, 9:32 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
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)

_________________
Image


Last edited by majkinetor on August 31st, 2009, 11:33 pm, edited 9 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2009, 10:03 pm 
majkinetor is on a coding spree!

8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2009, 10:31 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
I am actually polishing my previuosly unreleased work, inspired by recent AHK changes made mostly by Lexikos.

Expect many more goodies soon.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2009, 10:52 pm 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 775
Location: Texas, USA
Looks like another winner. Thanks. 8)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2009, 11:46 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Small bug with reseting of disabled hidden controls fixed.
Please re-download.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 1st, 2009, 2:10 am 
Offline

Joined: July 29th, 2005, 5:32 pm
Posts: 179
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!! 8)

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!   :D

_________________
.o0[ corey ]0o.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 16th, 2009, 1:20 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
*** 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.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 17th, 2009, 7:48 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
*** version 1.02 ***
! Resetting before adding any control would make function unusable.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 29th, 2009, 10:35 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
*** 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.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 29th, 2009, 12:53 pm 
Offline

Joined: February 11th, 2007, 4:10 pm
Posts: 185
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 29th, 2009, 7:30 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
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).

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 6th, 2009, 11:54 pm 
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.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 61 posts ]  Go to page 1, 2, 3, 4, 5  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Apollo, JamixZol and 7 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group