AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[module] Dock 1.0        (testing 2.0 b3)
Goto page Previous  1, 2, 3 ... 21, 22, 23, 24  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Brabus
Guest





PostPosted: Sat Feb 13, 2010 1:20 pm    Post subject: Reply with quote

I have used v2.0b3 to make the background layer stay behinde the layer text.

But I can figure it out how to move both of them holding L mouse button Sad


Code:
#SingleInstance force
SetWinDelay -1


Gui, 3:+LastFound -Caption +ToolWindow
Gui, 3:Color, red
Gui, 3:Add, Text, s9 cGreen w700 , background layer
Gui, 3:Show, w200 h200,Win_Background
w3 := WinExist(Win_Background)

Gui, 4:+LastFound -Caption +ToolWindow +border
Gui, 4:Color, black
Gui, 4:Add, Text, s9 cGreen w700 , text layer text layer text layer text layer`n text layer text layer text layer text layer`n text layer text layer text layer text layer`n text layer text layer text layer text layer`n
Gui, 4:Show,w120 h60, Win_Text
Dock_HostID := WinExist(Win_Text)


;###### Tweaking
Gui, 3:+LastFound 
WinSet, Transparent, 245 , Win_Background
WinSet, Region, 0-0 W200 h200 R20-20, Win_Background

Gui, 4:+LastFound 
WinSet, TransColor, black 100, Win_Text 
   

;###### Docking
Dock(w3, "x(0,0,-20) y(0,0,-20) ") ;w(1,40) h(1,40) t


;###### Move window without caption
OnMessage(0x201, "WM_LBUTTONDOWN")
WM_LBUTTONDOWN()
{
         IfWinNotActive, Win_Text
   PostMessage, 0xA1, 2
         ;IfWinNotActive, Win_Background
   ;PostMessage, 0xA1, 2         
}
return


#include Dock.ahk
~esc::exitapp
Back to top
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Sat Feb 13, 2010 1:44 pm    Post subject: Reply with quote

Use the oposite:


Code:
#SingleInstance force
SetWinDelay -1
SetBatchLines, -1


Gui, 3:+LastFound -Caption +ToolWindow
Gui, 3:Color, red
Gui, 3:Add, Text, s9 cGreen w700 , background layer
Gui, 3:Show, w200 h200,Win_Background
Dock_HostID := WinExist(Win_Background)

Gui, 4:+LastFound -Caption +ToolWindow +border
Gui, 4:Color, black
Gui, 4:Add, Text, s9 cGreen w700 , text layer text layer text layer text layer`n text layer text layer text layer text layer`n text layer text layer text layer text layer`n text layer text layer text layer text layer`n
Gui, 4:Show,w120 h60, Win_Text
w3 := WinExist()


;###### Tweaking
Gui, 3:+LastFound 
WinSet, Transparent, 245 , Win_Background
WinSet, Region, 0-0 W200 h200 R20-20, Win_Background

Gui, 4:+LastFound 
WinSet, TransColor, black 100, Win_Text 
   

;###### Docking
Dock(w3, "x(0,0,20) y(0,0,20) t") ;w(1,40) h(1,40) t


;###### Move window without caption
OnMessage(0x201, "WM_LBUTTONDOWN")
WM_LBUTTONDOWN()
{
         IfWinNotActive, Win_Text
   PostMessage, 0xA1, 2
         ;IfWinNotActive, Win_Background
   ;PostMessage, 0xA1, 2         
}
return


#include Dock.ahk
~esc::exitapp

_________________
Back to top
View user's profile Send private message
Brabus
Guest





PostPosted: Sat Feb 13, 2010 1:48 pm    Post subject: Reply with quote

Ahaaaaaa... Smile
Ty sir, works well
Back to top
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Sat Feb 13, 2010 1:59 pm    Post subject: Reply with quote

However, since you are using primarlly AHK GUIs, its better to use DockA (and much smoother):

Code:
#SingleInstance force
SetWinDelay -1
SetBatchLines, -1


Gui, 3:+LastFound -Caption +ToolWindow
Gui, 3:Color, red
Gui, 3:Add, Text, s9 cGreen w700 , background layer
Gui, 3:Show, w200 h200,Win_Background
Dock_HostID := WinExist(Win_Background)

Gui, 4:+LastFound -Caption +ToolWindow +border
Gui, 4:Color, black
Gui, 4:Add, Text, s9 cGreen w700 , text layer text layer text layer text layer`n text layer text layer text layer text layer`n text layer text layer text layer text layer`n text layer text layer text layer text layer`n
Gui, 4:Show,w120 h60, Win_Text
w3 := WinExist()


;###### Tweaking
Gui, 3:+LastFound 
WinSet, Transparent, 245 , Win_Background
WinSet, Region, 0-0 W200 h200 R20-20, Win_Background

Gui, 4:+LastFound 
WinSet, TransColor, black 100, Win_Text 
   

;###### Docking
DockA(Dock_HostID, w3, "x(0,0,20) y(0,0,20) t") ;w(1,40) h(1,40) t


;###### Move window without caption
OnMessage(0x201, "WM_LBUTTONDOWN")
WM_LBUTTONDOWN()
{
         IfWinNotActive, Win_Text
   PostMessage, 0xA1, 2
         ;IfWinNotActive, Win_Background
   ;PostMessage, 0xA1, 2         
}
return


#include DockA.ahk
~esc::exitapp

_________________
Back to top
View user's profile Send private message
Brabus
Guest





PostPosted: Sat Feb 13, 2010 2:06 pm    Post subject: Reply with quote

However,if I will replace the text in 'text layer' with a picture, I cant grab and move it no more, but only by click and drag the background.
That is in v2.0b3. I will test DockA now
Back to top
Brabus
Guest





PostPosted: Sat Feb 13, 2010 2:12 pm    Post subject: Reply with quote

No, DockA isn't working neither on text, nor picture.
Better v2.0b3. At least is working on text
Back to top
majkinetor !
Guest





PostPosted: Sat Feb 13, 2010 3:25 pm    Post subject: Reply with quote

The stuff you are talking about are not related to docking.
Also, it works. I posted you above DockA sample that works on your code.
Back to top
majkinetor !
Guest





PostPosted: Sat Feb 13, 2010 3:27 pm    Post subject: Reply with quote

Its important to realize DockHost movement is important, not client movement. When host moves, client moves. When client moves host does nothing. Thats docking. You obviously want to merge 2 guis as single up so docking might not be appropriate solution for you.
Back to top
Brabus
Guest





PostPosted: Sat Feb 13, 2010 7:04 pm    Post subject: Reply with quote

I'm sorry.
I understand.
Any suggestion for a better approach ?
Back to top
Brabus
Guest





PostPosted: Sat Feb 13, 2010 7:21 pm    Post subject: Reply with quote

that's it!..^0x00000020 - click through text layer Laughing
Back to top
doyle



Joined: 14 Nov 2007
Posts: 325
Location: London, England

PostPosted: Thu Feb 25, 2010 4:08 pm    Post subject: Reply with quote

Hey Maj,

I have this test script that will attach a GUI dock when a new instance of Notepad is created.

Do you have an idea of how to create another dock if another notepad window is opened?

So far, it only works for one instance.

Thanks for the Dock function.

Code:
#Persistent
SetBatchLines, -1
Process, Priority,, High

Gui +LastFound
hWnd := WinExist()

DllCall( "RegisterShellHookWindow", UInt,hWnd )
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )
Return



ShellMessage( wParam,lParam ) {
   Global
  If ( wParam = 1 ) ;  HSHELL_WINDOWCREATED := 1
     {
       WinGetClass, class, ahk_id %lParam%
       If  ( class = "Notepad" )
         {
         Dock_HostID := WinExist("ahk_id " . lParam)
         ;MsgBox, %Dock_HostID%

         Gui +LastFound +ToolWindow -Caption
         Gui, 1:Show, w1000 h28, Test
         c1 := WinExist()
         Dock(c1, "x(0,0,0) y(0,0,48) t")
         
         }
     }
}
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Thu Feb 25, 2010 5:45 pm    Post subject: Reply with quote

You can't have more then 1 dock host with this module.
The closest you can get is to make clients jump to another notepad when it gets activated.

I plan to allow multiple hosts and dynamic hosts (i.e. function that returns true if window is host or false if its not) in the future versions.
_________________
Back to top
View user's profile Send private message
doyle



Joined: 14 Nov 2007
Posts: 325
Location: London, England

PostPosted: Fri Feb 26, 2010 11:34 am    Post subject: Reply with quote

majkinetor wrote:
The closest you can get is to make clients jump to another notepad when it gets activated.


That sounds very good too.

What would I need to add to get it to switch?

A SetTimer?
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Fri Feb 26, 2010 4:06 pm    Post subject: Reply with quote

Just change Dock_HostId when you detect new notepad is activen and call Dock_Update.
_________________
Back to top
View user's profile Send private message
Tuncay



Joined: 07 Nov 2006
Posts: 1886
Location: Germany

PostPosted: Sat Feb 27, 2010 12:27 pm    Post subject: Reply with quote

I just tested this library and it is great. But first it did not work until I looked at the source. It contains subroutines which ends the the AutoExec section if I include it at the beginning of my script (like I do it allways).
I think at least there should be a requirement or limitation notice about that. May be some other are already irritated and gave up trying.

Isn`t it possible to wrap them out in functions? I see you are using SetTimer. I would appreciate if you find a way to avoid global subroutines. Would it work to put them in the function itself?? I tried a simple test of _Test2.ahk. But I dont know if there is any hidden bug because of that change.

Now I see a real world need and usage of SetTimers with function calls.
_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 21, 22, 23, 24  Next
Page 22 of 24

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group