Re: Dock - Attach a window to another
Posted: 09 May 2017, 10:56
The new example works well
How about a dock relative option?![Razz :P](./images/smilies/icon_razz.gif)
Cheers.
![Thumbup :thumbup:](./images/smilies/icon_thumbup.gif)
How about a dock relative option?
![Razz :P](./images/smilies/icon_razz.gif)
Cheers.
Let's help each other out
https://www.autohotkey.com/boards/
you mean like this ?Helgef wrote:dock relative option?
Code: Select all
; example dock with Relative position
#NoEnv
#SingleInstance, force
SetTitleMatchMode, 2
FormatTime, TimeString, , HH:mm:ss
Run, notepad.exe
sleep 100
WinGet, HostHwnd, ID, ahk_exe notepad.exe
; clock gui
Gui, +hwndClienthwnd +ToolWindow +AlwaysOnTop -SysMenu +E0x08000000
Gui, -Caption ; use this to remove the tooltip top!
Gui, Color, CCCCCC
Gui, Add, Picture, x3 y0 icon44 w16, shell32.dll
Gui, Font, cFFFFFF s6 wbold, terminal
Gui, Add, Text, vTxtCurrentTime xp+20 y2, %TimeString%
; Instance := new Dock(Host hwnd, Client hwnd, [Callback], [CloseCallback])
Instance := new Dock(Hosthwnd, Clienthwnd)
Instance.CloseCallback := Func("CloseCallback")
Gui, Show, AutoSize NoActivate h18 w240
WinSet, TransColor, CCCCCC 255, ahk_class AutoHotkeyGUI
Instance.Position("Relative 25 5")
SetTimer, AdjustTime, 500
Return
CloseCallback(self)
{
WinKill, % "ahk_id " self.hwnd.Client
ExitApp
}
Esc::
GuiClose:
Gui, Destroy
ExitApp
AdjustTime:
FormatTime, TimeString, , HH:mm:ss
GuiControl, , TxtCurrentTime, %TimeString%
return
#include dock.ahk
so ,where is the code ..?Soft wrote: ↑09 May 2017, 10:18update 0.2.2
- -It is now possible to dock more than one window (still WIP, its code and style are provisional)
- -changed some class properties's name for future consistency
- -Now Host (formerly main window) and Client window(formerly attached window) dock each other
- -several changes... see code and example to check out
thanks,My network problem caused unable to view,I use a proxy to solved.
Code: Select all
EVENT_OBJECT_LOCATIONCHANGE(self, via)
{
Host := this.WinGetPos(self.hwnd.Host)
Client := this.WinGetPos(self.hwnd.Client)
If InStr(self.pos, "Embedded")
{
If (via = "host")
{
Return this.MoveWindow(self.hwnd.Client ;hwnd
, Host.x + Host.w/2 ;x
, Host.y ;y
, Client.w ;width
, Client.h) ;height
}
If (via = "client")
{
Return this.MoveWindow(self.hwnd.Host ;hwnd
, Client.x-Host.w/2 ;x
, Client.y ;y
, Host.w ;width
, Host.h) ;height
}
WinSet, AlwaysOnTop, On, % "ahk_id " . self.hwnd.Client
}