[function] Attach 1.1
Thank you very much
- It can correctly reset , which was one of the reasons to do it.
What are the advantages over Anchor()?
- 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)
majkinetor is on a coding spree!
F*ing A!! 8)
I am actually polishing my previuosly unreleased work, inspired by recent AHK changes made mostly by Lexikos.
When I release Panel control you will be able to use this function to attach controls inside it.
I can't wait!
Expect many more goodies soon.
! 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:
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.
+ "-" 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.
I'm trying to use this to Attach an emeded Firefox. I'm looking to replace what I used to use: Anchor("AtlAxWin1", "wh").
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:
ControlGet, Handle, Hwnd,, AtlAxWin1, Example_Window
ControlGet, Handle, Hwnd,, PWB, Example_Window... Etc. Like I said, pardon my ignorance.
Thank you for your time.