The Ape Posted December 14, 2007 Posted December 14, 2007 (edited) Last week someone asked how to make one of these. I gave them a really dirty way to do it using a slide control. I decided to implement the idea into a project I am currently working on. So, I scraped the slider way... and went a little cleaner. It does work with resizing, but will reset itself (didn't feel like going any further... it's all I needed). I know I've seen a few similar examples around, but... here it is anyway. Edit: Works with resizing properly without reseting itself. expandcollapse popup#include <GUIConstants.au3> $GUI = GUICreate("$GUI", 500, 250, -1, -1, $WS_OVERLAPPEDWINDOW) $EditL = GUICtrlCreateEdit("$EditL", 0, 0, 245, 250) GUICtrlSetBkColor(-1, 0xcccccc) $VslideWid = 6 $VslideWIdBy2 = Int($VslideWid / 2) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKLEFT) $EditR = GUICtrlCreateEdit("$EditR", 245 + $VslideWid, 0, 250, 250) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKLEFT + $GUI_DOCKRIGHT) GUICtrlSetBkColor(-1, 0xaaaaaa) ;~ $Drag = GUICtrlCreatePic("", 245, 0, $VslideWid, 250) ;~ GUICtrlSetImage(-1,"vertslider1.bmp") $Drag = GUICtrlCreateLabel("", 245, 0, $VslideWid, 250) GUICtrlSetCursor(-1, 13) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKLEFT) GUISetState() $LPos = ControlGetPos($GUI, "", $EditL) $RPos = ControlGetPos($GUI, "", $EditR) $DPos = ControlGetPos($GUI, "", $Drag) $WinTray = WinGetPos("[CLASS:Shell_TrayWnd]") While 1 $msg = GUIGetMsg() Select Case $msg = $Drag $LPos = ControlGetPos($GUI, "", $EditL) $RPos = ControlGetPos($GUI, "", $EditR) $DPos = ControlGetPos($GUI, "", $Drag) $WPos = WinGetPos($GUI) GUISetCursor(13, 1, $GUI) GUISetState(@SW_DISABLE, $GUI) Do $pos = GUIGetCursorInfo($GUI) ControlMove($GUI, "", $Drag, $pos[0] - $VslideWIdBy2, $DPos[1], $VslideWid, $DPos[3]) ;~ ControlMove($GUI, "", $EditL, $LPos[0], $LPos[1], $pos[0]-$VslideWIdBy2, $LPos[3]) ;~ ControlMove($GUI, "", $EditR, $pos[0]+$VslideWIdBy2, $RPos[1], $WPos[2]-$pos[0]-$VslideWid, $RPos[3]) Until $pos[2] = 0 ControlMove($GUI, "", $EditL, $LPos[0], $LPos[1], $pos[0] - $VslideWIdBy2, $LPos[3]) ControlMove($GUI, "", $EditR, $pos[0] + $VslideWIdBy2, $RPos[1], $WPos[2] - $pos[0] - $VslideWid, $RPos[3]) GUISetCursor() GUISetState(@SW_ENABLE, $GUI) GUICtrlSetState($Drag, $GUI_FOCUS) $LPos = ControlGetPos($GUI, "", $EditL) $RPos = ControlGetPos($GUI, "", $EditR) $DPos = ControlGetPos($GUI, "", $Drag) Case $msg = $GUI_EVENT_MAXIMIZE _Event() Case $msg = $GUI_EVENT_RESTORE _Event() Case $msg = $GUI_EVENT_RESIZED _Event() Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func _Event() $WPos = WinGetPos($GUI) ControlMove($GUI, "", $Drag, $DPos[0] - $VslideWIdBy2, $DPos[1], $VslideWid, $WPos[3] - $WinTray[3]) ControlMove($GUI, "", $EditL, $LPos[0], $LPos[1], $LPos[2] - $VslideWIdBy2, $WPos[3] - $WinTray[3]) ControlMove($GUI, "", $EditR, $DPos[0] + $VslideWIdBy2, $RPos[1], $WPos[2] - $RPos[0] - $VslideWid, $WPos[3] - $WinTray[3]) $LPos = ControlGetPos($GUI, "", $EditL) $RPos = ControlGetPos($GUI, "", $EditR) $DPos = ControlGetPos($GUI, "", $Drag) EndFunc ;==>_Event GUIDelete() Exit Thanks to MaudKip, Valery, and martin for their suggestions/modifications. Edited December 18, 2007 by The Ape FixJaw.comTriad-Art.com
therks Posted December 14, 2007 Posted December 14, 2007 (edited) Nifty, I had another approach to this same idea myself. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> Opt('GUIOnEventMode', 1) #region - Variable setup Global $iSizerHeight = 5 Global $iSizerTopLimit = 40 Global $iSizerBottomLimit = 35 + 20 ;~ NOT Constants - These need to be changeable Global $IGNORE_WM_MOVE = False Global $IGNORE_WM_PAINT = False #endregion #region - GUI construction $gui_Main = GUICreate('', 400, 300, -1, -1, $WS_OVERLAPPEDWINDOW, $WS_EX_ACCEPTFILES) GUISetOnEvent($GUI_EVENT_CLOSE, '_Generic') $lb_ContentFrame = GUICtrlCreateLabel('ContentFrame', 0, 0, 400, 180, $SS_SUNKEN) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlSetState(-1, $GUI_HIDE) $lb_SizerFrame = GUICtrlCreateLabel('SizerFrame', 0, 180, 400, $iSizerHeight, $SS_SUNKEN) GUICtrlSetResizing(-1, $GUI_DOCKSTATEBAR+$GUI_DOCKRIGHT+$GUI_DOCKLEFT) GUICtrlSetState(-1, $GUI_HIDE) $lb_ConsoleFrame = GUICtrlCreateLabel('ConsoleFrame', 0, 185, 400, 95, $SS_SUNKEN) GUICtrlSetResizing(-1, $GUI_DOCKSTATEBAR+$GUI_DOCKRIGHT+$GUI_DOCKLEFT) GUICtrlSetState(-1, $GUI_HIDE) $lb_Status = GUICtrlCreateLabel('', 0, 280, 400, 20, BitOR($SS_CENTERIMAGE, $SS_SUNKEN)) GUICtrlSetResizing(-1, $GUI_DOCKSTATEBAR+$GUI_DOCKRIGHT+$GUI_DOCKLEFT) #endregion #region - Sub Frames $gui_Content = GUICreate('ContentFrameWin', 1, 1, 0, 0, $WS_CHILD, Default, $gui_Main) GUISetOnEvent($GUI_EVENT_CLOSE, '_Generic') GUISetOnEvent($GUI_EVENT_DROPPED, '_Generic') $ed_Content = GUICtrlCreateEdit('', 0, 0, 1, 1) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUISetState() $gui_Sizer = GUICreate('SizerFrameWin', 400, $iSizerHeight, 0, 180, $WS_CHILD, Default, $gui_Main) GUISetCursor(11, 1) GUICtrlCreateLabel('', -5, 0, 410, $iSizerHeight, Default, $GUI_WS_EX_PARENTDRAG) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUISetState() $gui_Console = GUICreate('ConsoleFrameWin', 400, 90, 0, 190, $WS_CHILD, Default, $gui_Main) GUISetOnEvent($GUI_EVENT_CLOSE, '_Generic') $ed_Console = GUICtrlCreateEdit('', 0, 0, 400, 90) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUISetState() #endregion <- Sub frames GUIRegisterMsg($WM_SIZE, 'WM_SIZE') GUIRegisterMsg($WM_MOVE, 'WM_MOVE') GUIRegisterMsg($WM_PAINT, 'WM_PAINT') GUISetState(@SW_SHOW, $gui_Main) #region - Program idle While 1 Sleep(100) WEnd #endregion ;~ GUI Functions -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> Func _Generic() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE Exit 2 EndSwitch EndFunc ;~ Functions -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> Func _WinPosFromControl($hCtrlWnd, $iCtrl, $hMoveWnd) Local $aControl = ControlGetPos($hCtrlWnd, '', $iCtrl) WinMove($hMoveWnd, '', $aControl[0], $aControl[1], $aControl[2], $aControl[3]) EndFunc ;~ Window Message Functions -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> -=> Func WM_SIZE($hWnd, $iMsg, $iWParam, $iLParam) If $hWnd = $gui_Main Then If Not BitAND(WinGetState($gui_Main), 16 + 32) Then $aSaveWinPos = WinGetPos($gui_Main) EndIf EndIf Return $GUI_RUNDEFMSG EndFunc Func WM_MOVE($hWnd, $iMsg, $iWParam, $iLParam) If $IGNORE_WM_MOVE Then Return $GUI_RUNDEFMSG If $hWnd = $gui_Main Then If Not BitAND(WinGetState($gui_Main), 16 + 32) Then $aSaveWinPos = WinGetPos($gui_Main) EndIf ElseIf $hWnd = $gui_Sizer Then $aClient = WinGetClientSize($gui_Main) $iYPos = BitShift($iLParam, 16) $iTopEdge = $iSizerTopLimit $iBottomEdge = $aClient[1] - $iSizerBottomLimit - 10 ; -10 to account for the height of the sizebar If $iYPos <= $iTopEdge Then $iYPos = $iTopEdge If $iYPos >= $iBottomEdge Then $iYPos = $iBottomEdge WinMove($gui_Sizer, '', 0, $iYPos, $aClient[0], $iSizerHeight) GUICtrlSetPos($lb_SizerFrame, 0, $iYPos, $aClient[0], $iSizerHeight) GUICtrlSetPos($lb_ContentFrame, 0, 0, $aClient[0], $iYPos) GUICtrlSetPos($lb_ConsoleFrame, 0, $iYPos + $iSizerHeight, $aClient[0], $aClient[1] - 20 - $iSizerHeight - $iYPos) EndIf EndFunc Func WM_PAINT($hWnd = 0, $iMsg = 0) If $IGNORE_WM_PAINT Then Return $GUI_RUNDEFMSG If $hWnd = $gui_Main Then _WinPosFromControl($gui_Main, $lb_ContentFrame, $gui_Content) _WinPosFromControl($gui_Main, $lb_SizerFrame, $gui_Sizer) _WinPosFromControl($gui_Main, $lb_ConsoleFrame, $gui_Console) EndIf EndFunc Not sure how clean that snippet is, I basically just took the application I'm working on and stripped out anything that wasn't needed to reproduce my splitter thing. Edited December 14, 2007 by Saunders My AutoIt Stuff | My Github
MaudKip Posted December 14, 2007 Posted December 14, 2007 (edited) Wouldn't it make more sense to detect when the primary is up instead of detecting when the secondary is pressed? Do $pos=GUIGetCursorInfo ($GUI) ControlMove($GUI, "", $Drag, $pos[0]-5, $DPos[1], 10, $DPos[3]) ControlMove($GUI, "", $EditL, $LPos[0], $LPos[1], $pos[0]-5, $LPos[3]) ControlMove($GUI, "", $EditR, $pos[0]+5, $RPos[1], $WPos[2]-$pos[0]-10, $RPos[3]) Until $pos[2] = 0 This creates a more realistic resizable bar. Great work btw. =] Edited December 14, 2007 by MaudKip
The Ape Posted December 15, 2007 Author Posted December 15, 2007 Wouldn't it make more sense to detect when the primary is up instead of detecting when the secondary is pressed? Do $pos=GUIGetCursorInfo ($GUI) ControlMove($GUI, "", $Drag, $pos[0]-5, $DPos[1], 10, $DPos[3]) ControlMove($GUI, "", $EditL, $LPos[0], $LPos[1], $pos[0]-5, $LPos[3]) ControlMove($GUI, "", $EditR, $pos[0]+5, $RPos[1], $WPos[2]-$pos[0]-10, $RPos[3]) Until $pos[2] = 0 This creates a more realistic resizable bar. Great work btw. =] You're absolutely correct (I'm not sure what I was thinking ). I changed the code in my first post. Thanks. Saunders, thanks for the feedback. FixJaw.comTriad-Art.com
MaudKip Posted December 17, 2007 Posted December 17, 2007 You're absolutely correct (I'm not sure what I was thinking ). I changed the code in my first post. Thanks. Saunders, thanks for the feedback.I may be using this code soon.I will credit you if I do.
ValeryVal Posted December 17, 2007 Posted December 17, 2007 MS think that sizes must be corrected after all. And I agreed: Do $pos=GUIGetCursorInfo ($GUI) ControlMove($GUI, "", $Drag, $pos[0]-5, $DPos[1], 10, $DPos[3]) Until $pos[2] = 0 ; Set sizes after all! ControlMove($GUI, "", $EditL, $LPos[0], $LPos[1], $pos[0]-5, $LPos[3]) ControlMove($GUI, "", $EditR, $pos[0]+5, $RPos[1], $WPos[2]-$pos[0]-10, $RPos[3]) There are many samples with very complicated left or right controls, for example hh.exe with AutoIt3.chm The point of world view
martin Posted December 17, 2007 Posted December 17, 2007 Last week someone asked how to make one of these. I gave them a really dirty way to do it using a slide control. I decided to implement the idea into a project I am currently working on. So, I scraped the slider way... and went a little cleaner. It does work with resizing, but will reset itself (didn't feel like going any further... it's all I needed). I know I've seen a few similar examples around, but... here it is anyway. expandcollapse popup#include <GUIConstants.au3> $GUI = GUICreate ("$GUI", 500, 250, -1, -1, $WS_OVERLAPPEDWINDOW) $EditL = GUICtrlCreateEdit("$EditL", 0, 0, 245, 250) GUICtrlSetBkColor(-1, 0xcccccc) GUICtrlSetResizing (-1, $GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKLEFT) $EditR = GUICtrlCreateEdit("$EditR", 255, 0, 250, 250) GUICtrlSetResizing (-1, $GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKLEFT+$GUI_DOCKRIGHT) GUICtrlSetBkColor(-1, 0xaaaaaa) $Drag = GUICtrlCreateLabel("$"&@CRLF&"D"&@CRLF&"r"&@CRLF&"a"&@CRLF&"g", 245, 0, 10, 250, $SS_CENTER) GUICtrlSetBkColor(-1, 0xff0000) GUICtrlSetCursor (-1, 13) GUICtrlSetResizing (-1, $GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKLEFT) GUISetState () While 1 $msg = GUIGetMsg() Select Case $msg = $Drag $LPos = ControlGetPos($GUI, "", $EditL) $RPos = ControlGetPos($GUI, "", $EditR) $DPos = ControlGetPos($GUI, "", $Drag) $WPos = WinGetPos($GUI) GUISetState(@SW_DISABLE, $GUI) Do $pos=GUIGetCursorInfo ($GUI) ControlMove($GUI, "", $Drag, $pos[0]-5, $DPos[1], 10, $DPos[3]) ControlMove($GUI, "", $EditL, $LPos[0], $LPos[1], $pos[0]-5, $LPos[3]) ControlMove($GUI, "", $EditR, $pos[0]+5, $RPos[1], $WPos[2]-$pos[0]-10, $RPos[3]) Until $pos[2] = 0 GUISetState(@SW_ENABLE, $GUI) Case $msg = $GUI_EVENT_CLOSE Exit EndSelect Wend GUIDelete () Exit That works well. I prefer to use a Pic rather than a label because then you can have it look like a conventional slider. expandcollapse popup#include <GUIConstants.au3> $GUI = GUICreate ("$GUI", 500, 250, -1, -1, $WS_OVERLAPPEDWINDOW) $EditL = GUICtrlCreateEdit("$EditL", 0, 0, 245, 250) GUICtrlSetBkColor(-1, 0xcccccc) $VslideWid = 6 $VslideWIdBy2 = Int($VslideWid/2) GUICtrlSetResizing (-1, $GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKLEFT) $EditR = GUICtrlCreateEdit("$EditR", 245 + $VslideWid, 0, 250, 250) GUICtrlSetResizing (-1, $GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKLEFT+$GUI_DOCKRIGHT) GUICtrlSetBkColor(-1, 0xaaaaaa) $Drag = GUICtrlCreatePic("", 245, 0, $VslideWid, 250) GUICtrlSetImage(-1,"vertslider1.bmp") GUICtrlSetCursor (-1, 13) GUICtrlSetResizing (-1, $GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKLEFT) GUISetState () While 1 $msg = GUIGetMsg() Select Case $msg = $Drag $LPos = ControlGetPos($GUI, "", $EditL) $RPos = ControlGetPos($GUI, "", $EditR) $DPos = ControlGetPos($GUI, "", $Drag) $WPos = WinGetPos($GUI) GUISetState(@SW_DISABLE, $GUI) Do $pos=GUIGetCursorInfo ($GUI) ControlMove($GUI, "", $Drag, $pos[0]-$VslideWIdBy2, $DPos[1], $VslideWid, $DPos[3]) ControlMove($GUI, "", $EditL, $LPos[0], $LPos[1], $pos[0]-$VslideWIdBy2, $LPos[3]) ControlMove($GUI, "", $EditR, $pos[0]+$VslideWIdBy2, $RPos[1], $WPos[2]-$pos[0]-$VslideWid, $RPos[3]) Until $pos[2] = 0 GUISetState(@SW_ENABLE, $GUI) Case $msg = $GUI_EVENT_CLOSE Exit EndSelect Wend GUIDelete () Exit Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
The Ape Posted December 18, 2007 Author Posted December 18, 2007 (edited) Thanks for all the suggestions. Valery, I agree... and have made the adjustments. martin, I like the more "conventional" look of an image. Kept it in the code, just commented it out. Also, thanks for the other additions. I've adjusted the code in the first post (also below). Changes I've made... Now, when maximizing or restoring down, controls will reset themselves properly. When I say properly, I mean in accordance to something like CHM (I really don't like how it restores down). Also, when resizing by dragging the window edge, the controls will jump back to their original position before falling back to where they should be. Not very attractive. Also, I made the "sizer" cursor visible during resize and set the focus back to the drag once complete. MaudKip, no need to credit me... just credit the Autoit Community. expandcollapse popup#include <GUIConstants.au3> $GUI = GUICreate("$GUI", 500, 250, -1, -1, $WS_OVERLAPPEDWINDOW) $EditL = GUICtrlCreateEdit("$EditL", 0, 0, 245, 250) GUICtrlSetBkColor(-1, 0xcccccc) $VslideWid = 6 $VslideWIdBy2 = Int($VslideWid / 2) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKLEFT) $EditR = GUICtrlCreateEdit("$EditR", 245 + $VslideWid, 0, 250, 250) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKLEFT + $GUI_DOCKRIGHT) GUICtrlSetBkColor(-1, 0xaaaaaa) ;~ $Drag = GUICtrlCreatePic("", 245, 0, $VslideWid, 250) ;~ GUICtrlSetImage(-1,"vertslider1.bmp") $Drag = GUICtrlCreateLabel("", 245, 0, $VslideWid, 250) GUICtrlSetCursor(-1, 13) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKLEFT) GUISetState() $LPos = ControlGetPos($GUI, "", $EditL) $RPos = ControlGetPos($GUI, "", $EditR) $DPos = ControlGetPos($GUI, "", $Drag) $WinTray = WinGetPos("[CLASS:Shell_TrayWnd]") While 1 $msg = GUIGetMsg() Select Case $msg = $Drag $LPos = ControlGetPos($GUI, "", $EditL) $RPos = ControlGetPos($GUI, "", $EditR) $DPos = ControlGetPos($GUI, "", $Drag) $WPos = WinGetPos($GUI) GUISetCursor(13, 1, $GUI) GUISetState(@SW_DISABLE, $GUI) Do $pos = GUIGetCursorInfo($GUI) ControlMove($GUI, "", $Drag, $pos[0] - $VslideWIdBy2, $DPos[1], $VslideWid, $DPos[3]) ;~ ControlMove($GUI, "", $EditL, $LPos[0], $LPos[1], $pos[0]-$VslideWIdBy2, $LPos[3]) ;~ ControlMove($GUI, "", $EditR, $pos[0]+$VslideWIdBy2, $RPos[1], $WPos[2]-$pos[0]-$VslideWid, $RPos[3]) Until $pos[2] = 0 ControlMove($GUI, "", $EditL, $LPos[0], $LPos[1], $pos[0] - $VslideWIdBy2, $LPos[3]) ControlMove($GUI, "", $EditR, $pos[0] + $VslideWIdBy2, $RPos[1], $WPos[2] - $pos[0] - $VslideWid, $RPos[3]) GUISetCursor() GUISetState(@SW_ENABLE, $GUI) GUICtrlSetState($Drag, $GUI_FOCUS) $LPos = ControlGetPos($GUI, "", $EditL) $RPos = ControlGetPos($GUI, "", $EditR) $DPos = ControlGetPos($GUI, "", $Drag) Case $msg = $GUI_EVENT_MAXIMIZE _Event() Case $msg = $GUI_EVENT_RESTORE _Event() Case $msg = $GUI_EVENT_RESIZED _Event() Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func _Event() $WPos = WinGetPos($GUI) ControlMove($GUI, "", $Drag, $DPos[0] - $VslideWIdBy2, $DPos[1], $VslideWid, $WPos[3] - $WinTray[3]) ControlMove($GUI, "", $EditL, $LPos[0], $LPos[1], $LPos[2] - $VslideWIdBy2, $WPos[3] - $WinTray[3]) ControlMove($GUI, "", $EditR, $DPos[0] + $VslideWIdBy2, $RPos[1], $WPos[2] - $RPos[0] - $VslideWid, $WPos[3] - $WinTray[3]) $LPos = ControlGetPos($GUI, "", $EditL) $RPos = ControlGetPos($GUI, "", $EditR) $DPos = ControlGetPos($GUI, "", $Drag) EndFunc ;==>_Event GUIDelete() Exit Edited December 18, 2007 by The Ape FixJaw.comTriad-Art.com
MaudKip Posted December 18, 2007 Posted December 18, 2007 Thanks for all the suggestions. Valery, I agree... and have made the adjustments. martin, I like the more "conventional" look of an image. Kept it in the code, just commented it out. Also, thanks for the other additions. I've adjusted the code in the first post (also below). Changes I've made... Now, when maximizing or restoring down, controls will reset themselves properly. When I say properly, I mean in accordance to something like CHM (I really don't like how it restores down). Also, when resizing by dragging the window edge, the controls will jump back to their original position before falling back to where they should be. Not very attractive. Also, I made the "sizer" cursor visible during resize and set the focus back to the drag once complete. MaudKip, no need to credit me... just credit the Autoit Community. expandcollapse popup#include <GUIConstants.au3> $GUI = GUICreate("$GUI", 500, 250, -1, -1, $WS_OVERLAPPEDWINDOW) $EditL = GUICtrlCreateEdit("$EditL", 0, 0, 245, 250) GUICtrlSetBkColor(-1, 0xcccccc) $VslideWid = 6 $VslideWIdBy2 = Int($VslideWid / 2) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKLEFT) $EditR = GUICtrlCreateEdit("$EditR", 245 + $VslideWid, 0, 250, 250) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKLEFT + $GUI_DOCKRIGHT) GUICtrlSetBkColor(-1, 0xaaaaaa) ;~ $Drag = GUICtrlCreatePic("", 245, 0, $VslideWid, 250) ;~ GUICtrlSetImage(-1,"vertslider1.bmp") $Drag = GUICtrlCreateLabel("", 245, 0, $VslideWid, 250) GUICtrlSetCursor(-1, 13) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKLEFT) GUISetState() $LPos = ControlGetPos($GUI, "", $EditL) $RPos = ControlGetPos($GUI, "", $EditR) $DPos = ControlGetPos($GUI, "", $Drag) $WinTray = WinGetPos("[CLASS:Shell_TrayWnd]") While 1 $msg = GUIGetMsg() Select Case $msg = $Drag $LPos = ControlGetPos($GUI, "", $EditL) $RPos = ControlGetPos($GUI, "", $EditR) $DPos = ControlGetPos($GUI, "", $Drag) $WPos = WinGetPos($GUI) GUISetCursor(13, 1, $GUI) GUISetState(@SW_DISABLE, $GUI) Do $pos = GUIGetCursorInfo($GUI) ControlMove($GUI, "", $Drag, $pos[0] - $VslideWIdBy2, $DPos[1], $VslideWid, $DPos[3]) ;~ ControlMove($GUI, "", $EditL, $LPos[0], $LPos[1], $pos[0]-$VslideWIdBy2, $LPos[3]) ;~ ControlMove($GUI, "", $EditR, $pos[0]+$VslideWIdBy2, $RPos[1], $WPos[2]-$pos[0]-$VslideWid, $RPos[3]) Until $pos[2] = 0 ControlMove($GUI, "", $EditL, $LPos[0], $LPos[1], $pos[0] - $VslideWIdBy2, $LPos[3]) ControlMove($GUI, "", $EditR, $pos[0] + $VslideWIdBy2, $RPos[1], $WPos[2] - $pos[0] - $VslideWid, $RPos[3]) GUISetCursor() GUISetState(@SW_ENABLE, $GUI) GUICtrlSetState($Drag, $GUI_FOCUS) $LPos = ControlGetPos($GUI, "", $EditL) $RPos = ControlGetPos($GUI, "", $EditR) $DPos = ControlGetPos($GUI, "", $Drag) Case $msg = $GUI_EVENT_MAXIMIZE _Event() Case $msg = $GUI_EVENT_RESTORE _Event() Case $msg = $GUI_EVENT_RESIZED _Event() Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func _Event() $WPos = WinGetPos($GUI) ControlMove($GUI, "", $Drag, $DPos[0] - $VslideWIdBy2, $DPos[1], $VslideWid, $WPos[3] - $WinTray[3]) ControlMove($GUI, "", $EditL, $LPos[0], $LPos[1], $LPos[2] - $VslideWIdBy2, $WPos[3] - $WinTray[3]) ControlMove($GUI, "", $EditR, $DPos[0] + $VslideWIdBy2, $RPos[1], $WPos[2] - $RPos[0] - $VslideWid, $WPos[3] - $WinTray[3]) $LPos = ControlGetPos($GUI, "", $EditL) $RPos = ControlGetPos($GUI, "", $EditR) $DPos = ControlGetPos($GUI, "", $Drag) EndFunc ;==>_Event GUIDelete() ExitWill do. =]
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now