AutoHotkey Community

It is currently May 26th, 2012, 9:15 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 352 posts ]  Go to page Previous  1 ... 17, 18, 19, 20, 21, 22, 23, 24  Next
Author Message
 Post subject:
PostPosted: October 20th, 2008, 10:08 am 
Offline

Joined: October 27th, 2006, 10:12 am
Posts: 649
majkinetor, you are the man again, with huge quantitative application potential for software practice in "super cool flowed mode".

I have to read more here and test your codes, maybe after that I will have new ideas worth to be added here. Thanks for sharing this great work!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 20th, 2008, 12:08 pm 
Offline

Joined: October 27th, 2006, 10:12 am
Posts: 649
It would be also interesting to collect somewhere a list of conceptual principles of what can/should be docked with what and why (what would be the gained value)?

Examples:
- host having multiple clients and each client gives more details on certain information available in host, e.g. zoom in/sub parts/decomposed parts
- host having multiple clients and each client gives more general overview information about information in host, e.g. zoom out/overview/big picture view/visualizations

One simple and direct example would be having a .csv file as host with numbers in multiple columns in it and the multiple clients would show/visualize/summarize/stochastic analysis information about these "numbers in columns", so with the right additional tools a simple stupid .csv file would get a totally new meaning which would be fun to play with.


I didn't check your code and the posts in this thread yet, but I can add some more current thoughts about Dock:
- I read, we can dock multiple clients to a host, which sounds good. Which alignment possibilities do we have around the host window? e.g. is it possible also to align 6 client windows in a hexagonal form around the host/current window which should sit in the middle of the hexagon.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 26th, 2008, 11:08 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
There seems to be be a bug in dock.ahk version 2.0 b3: If you undock a window, and re-dock it a couple of times (like at moving), the data structure gets corrupted. In the Dock() function definition, after
Code:
      idDel := Dock_%pClientID%
adding the following two lines (with a local variable j), might help:
Code:
      j := Dock_aClient[%cnt%]
      Dock_%j% := idDel


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 27th, 2008, 1:58 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
2Laszlo
Thanks for reporting this bug.


2automaticman
I didn't see your post before so this is delayed replay:

Possibilities of Dock are endless - you can extend, change and upgrade any application. Its your creativity only.

The code is very simple, and it can be quickly changed, although you generaly don't need to.

For instance this is the multiple hosts - multiple clients system that I am using with my private version of Favmenu 3.

Favmenu adds its icon as 4th button on any window it extends. There are 5 system dialogs/windows it extends. As FM3 is pluginable, any window can be extended if you write adequate function. This function is called by FavMenu_DialogGetActive which returns 0 if active window is not extended by FM3 or 1 if it is and saves handle of the window in Favmenu_dlgHwnd. The dialog becomes dock host this way:

Code:
if FavMenu_DialogGetActive() {
   Dock_HostId := Favmenu_dlgHwnd
   return
}


There are no changes is in Dock module itself :)

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2008, 12:10 am 
Offline

Joined: December 4th, 2006, 10:35 am
Posts: 561
Location: Galil, Israel
Laszlo wrote:
There seems to be be a bug in dock.ahk version 2.0 b3: If you undock a window, and re-dock it a couple of times (like at moving), the data structure gets corrupted. In the Dock() function definition, after
Code:
      idDel := Dock_%pClientID%
adding the following two lines (with a local variable j), might help:
Code:
      j := Dock_aClient[%cnt%]
      Dock_%j% := idDel



@majkinetor,


just glanced at this,

but if helpful, also looks like you're not resetting the client at shutdown.


ie. you've made the client a child of host, but on shutdown don't restore.


eg.,
Code:
loop, % Dock_aClient[0]
   {
   
      cId := Dock_aClient[%A_Index%], Dock_aClient[%A_Index%] := ""
      DllCall("SetWindowLong", "uint",cID , "int", -8, "uint",0)
      Dock_%cID% := ""
      loop, 10
         Dock_%cID%_%A_Index% := ""
   }

_________________
Joyce Jamce


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 26th, 2009, 2:27 pm 
Offline

Joined: October 27th, 2006, 10:12 am
Posts: 649
majkinetor wrote:
Favmenu 3.
Can we download Favmenu 3 from anywhere, I found only Favmenu 2.0 final in the forum?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 26th, 2009, 7:15 pm 
Offline

Joined: October 27th, 2006, 10:12 am
Posts: 649
It would be nice if Dock would work with WindowPad or vice versa.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 21st, 2009, 3:06 am 
Offline

Joined: April 13th, 2009, 8:18 am
Posts: 5
Location: Australia
I'm trying to make a gui sit on top of the host window but as the documentation says - "Currently its not supported to set Client window on top Host window."

Just wondering if anyone has some ideas on how it could be accomplished.

Have tried without avail with setting the Z-order with setting the hWndInsertAfter parameter to HWND_TOPMOST, without any success (probably due to my programming more than anything else)


:D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 26th, 2009, 10:28 pm 
Offline

Joined: December 29th, 2007, 9:40 pm
Posts: 142
Majkinetor, Good day, sir.

I am finally getting around to throwing in the towel wrt my implementation of docking my IDE window in an editor.

The editor I am using is Notepad++. It has a docking framework for plugins. I have created a 'blank plugin' that I'd like to attach a client gui to.

I have the IDE gui attaching to my plugin, using your module, only when the host app starts and the plugin is in an undocked state - i.e. a child window, however, when it get's docked within the framework of the host application, the client gui hides itself.

My question is this: What approach could you possibly recommend for assigning the same client gui to attach itself to two different hosts that will never co-exist?

I was thinking about listening for a msg that is broadcast when the plugin is docked or undocked, and re-defining the client's dock parameters concurrent with said event. Thoughts?

Please review and advise when able. Thank you, in advance.

-t

[edit] p.s. I am using 2.0 b3 [/edit]

_________________
When replying, please feel free to address me as Tod. My AHK.net site...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 27th, 2009, 11:12 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Your solution is good enough. Maybe Ill provide support for this kind of situation when I find time, cuz I already use it the same way - multiple hosts (even future ones) with single client.

I might change the Dock in the near future to hide globals tho, but prinicple will stay the same.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 31st, 2009, 9:05 pm 
Offline

Joined: December 29th, 2007, 9:40 pm
Posts: 142
Majkinetor,

Thank you very much for taking the time to reply. Much appreciated!

I am struggling a bit with a couple of items related to the Dock module and I'd like to solicit you for more input, if you are able and willing, please:

1) I am struggling with getting a single client to be associated with and docked with two different top-level host windows (that never co-exist - I believe that they are mutually exclusive in that when one is instantiated, the other is totally destroyed, not just hidden, based on user actions within the host application. At least that is what winspector is leading me to believe...). I suspect that my multi-host struggles is due to the fact that you are making use of the clientid as part of the variable names in the lib functions.?.

You made mention that you are using a version of your dock tool (;)) that supports multiple hosts for a single client, if I understood you correctly. Is it possible that I can leech off of you for your scripts, so that I can use them as a frame of reference in mod'g up a custom dock lib to fulfill my asserted needs? Thanks, in advance, for the consideration.

2) I am also struggling with having a host control that is not a top-level window. When instantiated, the client gui does indeed get sized and stuck to the host control, but when the control is moved/redocked on another edge/sized, or the owning window is moved/sized, the client gui doesn't get updated. I suspect that your hooks are for proper top-level-window related callbacks, and not for control-level callbacks. Is this an accurate assessment?

If so, do you have knowledge of how one might modify the callbacks to work with controls embedded within another GUI, in a manner that you have done with facilitating docking to top-level-window hosts? The goal is to dock an .ahk gui to a non-ahk client (child?) window that is docked inside of another Win32 application.

Sorry if I am too wordy in my diatribe. Just wanting to make sure that I clearly state my understandings, struggles, and requests. Hopefully I have succeeded in this...

Thank you for your time.

Take care.

-t

_________________
When replying, please feel free to address me as Tod. My AHK.net site...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 5th, 2009, 1:03 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Quote:
1) I am struggling with getting a single client to be associated with and docked with two different top-level host windows

You can do this. Just register dock client with new host each time its created. It must be repeated as host hwnd will be different. Alternatively you can change module to compare class instead of hwnd. If you can't control Host creation or you are not notified about it, then simple timer will do (although ideally, dock should be able to recognize new host). When time comes to devote my time to this module I will probably make this feature.

Quote:
2) I am also struggling with having a host control that is not a top-level window ....... I suspect that your hooks are for proper top-level-window related callbacks, and not for control-level callbacks. Is this an accurate assessment?

Yes, hooking controls isn't supported. The single line is responsible for this that returns from module when it detects notifications about child windows. You can change this. However, keep in mind that AHK is problematic ( a lot ) when dealing with functions running on message-like frequency. Since Dock monitors entire system, its notification function will be called by the system *a lot* (for each child, top level, tooltip and so on.. window created or moved). I was returning control to the script ASAP if window is not top level for the sake of CPU utilization and notorious problems with criticial command, message skipping and function reevocation. Perhaps it can be done better although Dock module is short peace of code where every single line is crafted over months to produce the best effect (and its still not perfect). AHK changed a bit since then so its time to update it and maybe support child controls hooking.

Quote:
The goal is to dock an .ahk gui to a non-ahk client (child?) window that is docked inside of another Win32 application.

This may be done now (I am not sure how good it will be). You can use T dock to put AHK gui ontop non-ahk gui. Then you need timer to check if control is moved and readjuce the dock definition. If control is not moving frequently it will be OK.

This is the important part of the module:

Code:
Dock_HookProc(hWinEventHook, event, hwnd, idObject, idChild, dwEventThread, dwmsEventTime ) {
   local e,     cls, style

   if idObject or idChild
      return
   WinGet Style, Style, ahk_id %hwnd%
   if (Style & 0x40000000)               ;RETURN if hwnd is child window, idChild may be 0 for some children!
      return

   WINGETCLASS, cls, ahk_id %hwnd%
   if cls in #32768,#32771,#32772,#32769,SysShadow,tooltips_class32
      return


I pasted part that is responsible for fast return and you can see that function returns when it encounters Child or Object.

This is the part of the code from private Favmenu version that has multiple hosts.

Code:
Dock_HookProc(hWinEventHook, event, hwnd, idObject, idChild, dwEventThread, dwmsEventTime ) {
   local e,     cls, style

   if idObject or idChild
      return
   WinGet Style, Style, ahk_id %hwnd%
   if (Style & 0x40000000)               ;
      return

   Dock_HostID   := hwnd
   gosub Dock_GetHandle


......


Dock_GetHandle:
   if FavMenu_DialogGetActive() {
      Dock_HostId := Favmenu_dlgHwnd
      return
   }
   Dock_HostId := -1
return

In it, FavMenu_DialogGetActive checks active window to determine if its the window it handles. If it is , i set Dock_hostID to handle of the dialog so that favmenu icon can be docked as 4th button in the dialogs tittlebar. Favmenu monitors 7 types of dialogs.

I hope I helped.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2009, 7:01 am 
Offline

Joined: December 29th, 2007, 9:40 pm
Posts: 142
Thanks, Majkinetor.

I haven't yet had time to absorb it all, but I surely appreciate your taking the time to offer up such a detailed reply.

majkinetor wrote:
You can do this. Just register dock client with new host each time its created.

With respect to your suggestion, the hosts are not part of my scripts, but rather two different instances of a NPP module. Confusing, I know. I'll elaborate a bit.

Right now, in my implementation of a docking solution using home-grown code, I have a polling loop setup to test for the existence of the NPP host window or control (be it undocked or docked, respectively).

I have come to discover, via winspector, that when the host window becomes undocked, it'll get a hwnd. If it gets docked and undocked again, the damn hwnd changes to something else. If I dock it and undock it a second time, the hwnd goes back to the initial hwnd. I believe that this is a result of either the NPP plugin's code, or NPP's docking infrastructure.

So, there are three possible external hosts that I want to glue my ahk client to - either of the two top-level windows, and also the control, when the host becomes docked within NPP. I acknowledge and assert understanding of the current limitation wrt the host being a control...

It seems that you might be indirectly suggesting, since my .ahk script is NOT in control of any of the hosts, that I still poll to get the hwnd of the host, and re-assert the client definition, when either of the host windows gets instantiated (and when the host control gets instantiated, if the module is rev'd to handle child controls as hosts).

My reason for trying to implement a good solution, using your dock module, is to try to get a way from the damn polling approach that I had initially taken - it is ugly and makes me want to vomit, whenever I revisit the code - hack on top of hack on top of more hacks - ugh.!.

While that is the goal, I do understand that it might not be an achievable goal, without some serious customization of the dock module's implementation...

grrrr... ;-)

Regardless, I offer you a huge thank you. I am truly grateful for your precious time. I bid you a wonderful weekend, kind sir!

-t

_________________
When replying, please feel free to address me as Tod. My AHK.net site...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2009, 1:52 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
I see.

The best solution, then, would be to omit polling and to change Dook_HookProc to have something like this:

Code:
Dock_HookProc(hWinEventHook, event, hwnd, idObject, idChild, dwEventThread, dwmsEventTime ) {
   local e,     cls, style

   if idObject or idChild
      return

   WinGet Style, Style, ahk_id %hwnd%
   if (Style & 0x40000000)               ;RETURN if hwnd is child window, idChild may be 0 for some children!
      return

  WINGETCLASS, cls, ahk_id %hwnd%
   if cls in #32768,#32771,#32772,#32769,SysShadow,tooltips_class32
      return

  if cls in MyCls1,MyCls2
    Dock_HostID := hwnd


The red code checks the ahk_class and if its correct, sets HostId to hwnd of that window.

It isn't tested, from the head, but should work...

Keep in mind that polling is not that bad solution if you omit the little latency in docking when configuration changes.

Quote:
Regardless, I offer you a huge thank you. I am truly grateful for your precious time. I bid you a wonderful weekend, kind sir!

Thanks for nice words. I wish I have more time to help you but ATM I am adapting my apartment and in next few months I wont have much time for programming. When I get to the Dock module again, Ill check out your scenario in more details and maybe provide solution. Its my goal to have docking module as flexible as it can for broadest usage.
Thanks for testing it.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 14th, 2009, 7:51 pm 
Offline

Joined: November 14th, 2007, 2:47 pm
Posts: 335
Location: London, England
Thank you for this great function Majkinetor!

This has changed the way I work forever!

With regards to using the Dock on multiple instances of the same host, how would I go about adding this?

My code is as below.

If possible I would have 1 Client GUI on Multiple Host Windows.

I've tried using SetTimers, to try and update, but I havent found a way to do it.

Thank you again.

Code:
SetBatchLines, -1
#SingleInstance, force

   host := "ahk_class SAP_FRONTEND_SESSION"

   Dock_OnHostDeath := "OnHostDeath"
   
   Gui, +LastFound +ToolWindow -Border -Resize -Caption
   c1 := WinExist()

   Dock(c1, "x(,,) y(,-1,66) w(1,0) h(,36) t")

   
return

FindHost:
   if Dock_HostID := WinExist(host)
   {
      SetTimer, FindHost, OFF   
      Dock_Toggle(true)
   }
return

OnHostDeath:
   SetTimer, FindHost, 100
return

F7::Reload

#include Dock.ahk


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 352 posts ]  Go to page Previous  1 ... 17, 18, 19, 20, 21, 22, 23, 24  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 9 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