Dock desired top level windows (dock clients) to any top level window (dock host)
Run notepad,,,nPID WinWait ahk_pid %nPID% Dock_HostID := WinExist("ahk_pid " . nPID) Gui +LastFound -Caption +ToolWindow +Border Gui Add, Text,,Docked Window Gui Show Dock(WinExist(), "0,0,0, 0,-1,-5, 0,120, 0,30") ; above, left, fixed width return [color=red]#include Dock.ahk[/color]
See also Title Button
- Fixed bug with "working cursor" and T clients.
- Removed "+" option. You should start dock with hidden windows, and Dock will show them after it positioned them correctly if they are hidden. So, Dock itself hides and shows the windows, you just need to Toggle it on once you set up the new host as it will still turn off when Host dies. To let the client be hidden, you must undock it. This is better anyway, as previously hidden clients were still aranged by the Dock, although they were invisible, so update was slower.
- Bug fix when host is alive in the moment of registration. Clients are now (hopefully) positioned correctly.
- Topmost clients reimplement. Now they work much faster. New example: _Bmcclure.ahk. It shows how to dock to the control. "Docking relative to the control" will be added in next version.
v2.0 a5 Screenshot1 Screenshot 2
- Dock definition alternative notation for shorter expressions
- Optimisation & bug fixes
- Dock definition changed to more clear notation. This intorduced some new docking shemes (X & Y class can be omitted now). See _Mini WIn.ahk & Roll.ahk
- TopMost clients added as 11th parameter of dock definition. See help in the archive for details about topmost clients. This feature allows new dimension of docking as you can dock inside the Host. This also makes possible to create arbitrary number of title buttons (you can see that in one of the samples in the archive)
- Final version
- Documentation updated (switched from mht to html, presets section added, dock defintion explained, remarks about topmost clients added, now available online)
- Activating client will now activate host. All in all, composite window now behaves like single window.
- Dock now also monitors SHOW and HIDE states of the Host (if DetectHiddenWindows is set). Furthermore, when Host terminates, all clients will be hidden from now on and you must explicitely show them if you re-enable dock with new Host. See _Test2.ahk for example.
- Dock_HostDied removed from API. Dock now automaticaly Toggle's itself OFF when Host dies (and hides the clients)
- New cool example added (set host and number of clients, can be used for mass client testing)
- Some bugs fixed:
Improper Z-order if Host was active in the time script was executing
Toggle improved so it returns error when you try to enable already enabled dock
- New function - Dock_Toggle. Dock_Enabled removed for optimisation reason. Dock_Toggle makes suspended state of module 100% idle.
- Removed "F" from RegisterCallback
- If you call Dock again for the same client it will update previous settings
- Shutdown will clean all internal data and module can be used again after shutdown is called.
- WinSetDelay doesn't influence module anymore
- New global, Dock_Enabled to temporary disable dock
- Dock definition can now accept only X & Y parameters (first 6). W & H parameters can now be omited. Module will let the client keep its size. You can also omit only W or only H.
- Dock definition can now be entirely omited. In that case client will be docked relatively to already running Dock_Host, i.e. it will keep the distance it had from the Host at the moment Dock was callled.
- You can use "+" now when passing client's ID to make module show hidden client before docking it to the host.
- New _Test.ahk, demonstrating all the things mentioned above.
- wineventhook.dll removed
- Added another 2 global variables Dock_OnHostDeath and Dock_HostDied. Set first one to subroutine to make engine call it when host dies. This routine is called only once and it will change global Dock_HostDied to true. If you want to switch the host you will have to reenable Dock_OnHostDeath by setting HostDied to 0.
- Multidock implemented
- Dock syntax changed as of multidock feature
- Optimisation, stripped version of script is less then 100 lines (no comments, empty lines etc..)
0.96 - Another optimisation
0.95 - Encapsulation.
0.91 - New interface and optimisation (thx Laszlo)
0.00 - Initial[/list]
[*:2eelkclu]Explanation of dock definition string
[*:2eelkclu] Original idea.
[*:2eelkclu]How to set up out of context hoooks
[*:2eelkclu] WinEvents @ MSDN
[*:2eelkclu]WinEvents by JGR
JGR, Laszlo, Joy2DWorld, bmcclure[/list]