AutoHotkey: Double click resets the splitter
Jump to navigation
Jump to search
#IfWinActive ahk_class TTOTAL_CMD ~LButton:: ; Detect double click code: http://www.autohotkey.com/forum/viewtopic.php?p=62779#62779 Loop { LButtonDown := GetKeyState("LButton","P") If (!LButtonDown) Break } WaitTime:=DllCall( "GetDoubleClickTime" )/1000 KeyWait, LButton, D T%WaitTime% If errorlevel=0 GoSub, OnDoubleClick Return OnDoubleClick: ; Determine the splitter class name. ; Since there are more TPanel controls (the splitter is one of them), ; I use the dimensions of the controls to decide. WinGet sf_aControls, ControlList Loop Parse, sf_aControls, `n { StringLeft sf_sTemp, A_LoopField, 6 if (sf_sTemp = "TPanel") { ControlGetPos Cx,Cy,Cw,Ch, %A_LoopField% if (Cw < 16) { SplitterClass := A_LoopField Break } } } ; If the mouse is over the splitter, send cm_50Percent command. MouseGetPos, , , , ClassUnderMouse if (SplitterClass = ClassUnderMouse) { ; Wait for the left button to be released. ; This is necessary, beause if we send the cm_50Percent ; message when the button is still down, the splitter jumps back to the mouse. KeyWait LButton PostMessage 1075, 909, 0,, ahk_class TTOTAL_CMD ; cm_50Percent } Return
Back to AutoHotkey