[function] DockA 1.0
This is nicely coded function.
Edit: Couple of small possible bugs:
You are using STATIC variables to save global toggle states. This is not a good idea. You should use LOCAL variables instead.
I found what I think may be a bug while trying to call DockA as a library. I'm new to scripting so it may not be a bug.
ifEqual, %HHost%,,returnI changed to
When trying to call as a library I got the "This dynamic variable is blank..." error message. Removing the "%" has it working so far for my script.
Thanks for a great app.
Using dock module you can glue windows to an AHK window.
So Majikinetor, if I want to glue a AHK script to a third part windows (i.e. notepad window) i have to use your other dock script, Dock.ahk, right ?
I have a 2 part question as I might not be taking the best approach to begin with. I am working on a tool that needs to be able to build GUI's dynamically, meaning I'm reading an INI file that has the coordinates for a collection of buttons that I'm turning into a GUI. To do this I have my main window that loads, then I read the INI file and generate the 2nd GUI. I want the 2nd gui to look/act as if it was built into main window.
I'm not sure if this is the best approach but it seems to work - where i build my main gui and then I generate the 2nd gui, using DockA to attach 2nd to the first and using the +owner1 config to make the 2nd window act like its part of the first. Is there a better way to build and attach a 2nd gui to the first gui using built in AHK functionality? If not this way works fine.. but comes my 2nd question ---
I can build the 2nd gui and attach it where I want it just fine when the 1st gui starts in a specific location on screen. I have the 2nd gui building at coordinate starting at 0,0 on the screen, so if the main window is moved to another monitor when it builds the 2nd gui it draws on the first monitor initially. Moving the main window forces the 2nd gui to reposition exactly where I want it to be positioned. I recognize that I could determine the window position of the first window before drawing the 2nd gui and adjust for the positioning that way, but it seems like it would be easier if I knew how to force DockA to automatically act as if I had just moved the main window - forcing DockA to move the 2nd gui to where I want it in relation to the main window.
Hopefully that makes sense - thanks :-)
**Edit** It looks like I can just move the main window by 1x coordinate and back quickly and that forces the redraw which will work, but the question still stands as to if this is the best approach?? Thanks
When I click on the client I can drag it away from the host.
How can I get prevent this? I only need the client to be able to be moved if the host is moved.
I am sure it has something to do with "You can monitor WM_WINDOWPOSCHANGED=0x47 to detect when user move clients (if they are movable) in order to update dock properties"
But I have no idea how to do that.
#include docka.ahk Gui 1: add, text,, this is the host Gui 1: show, w300 h300, Host WinGet,HostID,ID, Host Gui 2: add, text, ,this is the client gui 2: show, w300 h300, Client WinGet,ClientID,ID,Client Docka(HostID, ClientID, "x() y(1) w(1) h(,300)") return
#include docka.ahk Gui 1: add, text,, this is the host Gui 1: show, w300 h300, Host WinGet,HostID,ID, Host Gui 2: -Caption Gui 2: add, text, ,this is the client gui 2: show, w300 h300, Client WinGet,ClientID,ID,Client Docka(HostID, ClientID, "x() y(1) w(1) h(,300)") return
or this works but the client window does not dock to the bottom of the Host window until it is moved.