MikahS Posted October 23, 2014 Posted October 23, 2014 (edited) Hello AutoIt community, I have a question for you. I have 3 separate ListViews which need to be auto sized to the GUI width / height. I've looked around the forum for a day or two and have tried using the WM_SIZE method, which after playing with it, I've realized that not everyone's screen is the same and hardcoding it could be troublesome. So, I'm thinking I need to come up with a better way of resizing my ListViews to my GUI. Does anyone have any suggestions on different ways of achieving this goal? Example script: expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon= #AutoIt3Wrapper_Outfile= #AutoIt3Wrapper_Res_Comment= #AutoIt3Wrapper_Res_Description= #AutoIt3Wrapper_Res_Fileversion= #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <Constants.au3> #include <GUIListBox.au3> #include <GuiListView.au3> #include <Array.au3> #include <ButtonConstants.au3> #include <ScrollBarConstants.au3> #include <Misc.au3> #include <GuiScrollBars.au3> ;~ #include <GUIListViewEx.au3> Local $List1, $List2, $List3, $List4, $lp_Buffer = 0 Local $List1Ex, $List2Ex, $List3Ex GUI() GUIRegisterMsg($WM_SIZE, "WM_SIZE") _GUIScrollBars_EnableScrollBar(ControlGetHandle("", "", $List2), $SB_BOTH, $ESB_DISABLE_BOTH) _GUIScrollBars_EnableScrollBar(ControlGetHandle("", "", $List3), $SB_BOTH, $ESB_DISABLE_BOTH) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Quit() EndSwitch WEnd ;END MAIN LINE Func Quit() Exit EndFunc ;==>Quit Func GUI() Local $Index, $LV1, $LV2, $LV3 $GUIhandle = GUICreate("tester", 680, 575, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX) ;creates the parent window GUICtrlSetResizing(-1, $GUI_DOCKAUTO) ;;allows resizing of full window $List1 = _GUICtrlListView_Create($GUIhandle, "Computer Name", 20, 35, 300, 448, -1, $LVS_EX_DOUBLEBUFFER) ;;$ES_READONLY incase you don't want to be able to select text ;~ $List1Ex = _GUIListViewEx_Init($List1, "") _GUICtrlListView_SetExtendedListViewStyle($List1, $LVS_EX_TWOCLICKACTIVATE) $List2 = _GUICtrlListView_Create($GUIhandle, "Date/Time", 355, 35, 190, 450, -1, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FLATSB)) ;~ $List1Ex = _GUIListViewEx_Init($List2, "") $List3 = _GUICtrlListView_Create($GUIhandle, "Speed", 574, 35, 95, 450, -1, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FLATSB)) ;~ $List1Ex = _GUIListViewEx_Init($List3, "") GUICtrlCreateLabel("Additional Info", 20, 489) ;creates the label for $List4 GUICtrlSetResizing(-1, $GUI_DOCKSIZE) $List4 = GUICtrlCreateList("", 20, 512, 635, 40, BitOR($WS_BORDER, $WS_VSCROLL), $ES_READONLY) GUICtrlSetResizing($List4, $GUI_DOCKAUTO) GUICtrlCreateLabel("Active Connections: ", 525, 487) ;creates the label for the active connections GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUISetState(@SW_SHOW) ;shows the GUI window For $Index = 0 To 100 Step 1 $LV1 = _GUICtrlListView_AddItem($List1, " ") ;adds a default value into $List1 $LV2 = _GUICtrlListView_AddItem($List2, " ") ;adds a default value into $List2 $LV3 = _GUICtrlListView_AddItem($List3, " ") ;adds a default value into $List3 Next EndFunc ;==>GUI ;===========MAXIMIZE THE WINDOW TO SEE HOW THIS TRULY FUNCTIONS===============; Func WM_SIZE($hWnd, $msg, $wParam, $lParam) $iWidth = BitAND($lParam, 0xFFFF) ; _WinAPI_LoWord $iHeight = BitShift($lParam, 16) ; _WinAPI_HiWord If $lParam > $lp_Buffer Then _WinAPI_MoveWindow($List1, 20, 35, $iWidth - 1200, 900) Else _WinAPI_MoveWindow($List1, 20, 35, $iWidth - 400, 448) EndIf $lp_Buffer = $lParam Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE Any reply is much appreciated. Edited October 23, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
Moderators Melba23 Posted October 23, 2014 Moderators Posted October 23, 2014 MikahS,I would create disabled labels behind the ListViews which resize automatically and then resize the ListViews to fit the labels:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiScrollBars.au3> #include <GUIListViewEx.au3> #include <EditConstants.au3> Local $List1, $List2, $List3, $List4, $lp_Buffer = 0 Local $List1Ex, $List2Ex, $List3Ex Global $GUIhandle, $cLabel_1, $cLabel_2, $cLabel_3 GUI() GUIRegisterMsg($WM_SIZE, "WM_SIZE") _GUIScrollBars_EnableScrollBar(ControlGetHandle("", "", $List2), $SB_BOTH, $ESB_DISABLE_BOTH) _GUIScrollBars_EnableScrollBar(ControlGetHandle("", "", $List3), $SB_BOTH, $ESB_DISABLE_BOTH) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Quit() EndSwitch WEnd ;END MAIN LINE Func Quit() Exit EndFunc ;==>Quit Func GUI() Local $Index, $LV1, $LV2, $LV3 $GUIhandle = GUICreate("tester", 680, 575, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX) ;creates the parent window ;GUICtrlSetResizing(-1, $GUI_DOCKAUTO) ;;allows resizing of full window $List1 = _GUICtrlListView_Create($GUIhandle, "Computer Name", 20, 35, 300, 448, -1, $LVS_EX_DOUBLEBUFFER) ;;$ES_READONLY incase you don't want to be able to select text _GUICtrlListView_SetExtendedListViewStyle($List1, $LVS_EX_TWOCLICKACTIVATE) $cLabel_1 = GUICtrlCreateLabel("", 20, 35, 300, 448) GUICtrlSetState($cLabel_1, $GUI_DISABLE) GUICtrlSetResizing($cLabel_1,$GUI_DOCKAUTO ) GUICtrlSetBkColor($cLabel_1, $GUI_BKCOLOR_TRANSPARENT) $List2 = _GUICtrlListView_Create($GUIhandle, "Date/Time", 355, 35, 190, 450, -1, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FLATSB)) $cLabel_2 = GUICtrlCreateLabel("", 355, 35, 190, 450) GUICtrlSetState($cLabel_2, $GUI_DISABLE) GUICtrlSetResizing($cLabel_2,$GUI_DOCKAUTO ) GUICtrlSetBkColor($cLabel_2, $GUI_BKCOLOR_TRANSPARENT) $List3 = _GUICtrlListView_Create($GUIhandle, "Speed", 574, 35, 95, 450, -1, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FLATSB)) $cLabel_3 = GUICtrlCreateLabel("", 574, 35, 95, 450) GUICtrlSetState($cLabel_3, $GUI_DISABLE) GUICtrlSetResizing($cLabel_3,$GUI_DOCKAUTO ) GUICtrlSetBkColor($cLabel_3, $GUI_BKCOLOR_TRANSPARENT) GUICtrlCreateLabel("Additional Info", 20, 489) ;creates the label for $List4 GUICtrlSetResizing(-1, $GUI_DOCKSIZE) $List4 = GUICtrlCreateList("", 20, 512, 635, 40, BitOR($WS_BORDER, $WS_VSCROLL), $ES_READONLY) GUICtrlSetResizing($List4, $GUI_DOCKAUTO) GUICtrlCreateLabel("Active Connections: ", 525, 487) ;creates the label for the active connections GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUISetState(@SW_SHOW) ;shows the GUI window For $Index = 0 To 100 Step 1 $LV1 = _GUICtrlListView_AddItem($List1, " ") ;adds a default value into $List1 $LV2 = _GUICtrlListView_AddItem($List2, " ") ;adds a default value into $List2 $LV3 = _GUICtrlListView_AddItem($List3, " ") ;adds a default value into $List3 Next EndFunc ;==>GUI Func WM_SIZE($hWnd, $msg, $wParam, $lParam) $aRet = ControlGetPos($GUIhandle, "", $cLabel_1) WinMove($List1, "", $aRet[0], $aRet[1], $aRet[2], $aRet[3]) $aRet = ControlGetPos($GUIhandle, "", $cLabel_2) WinMove($List2, "", $aRet[0], $aRet[1], $aRet[2], $aRet[3]) $aRet = ControlGetPos($GUIhandle, "", $cLabel_3) WinMove($List3, "", $aRet[0], $aRet[1], $aRet[2], $aRet[3]) Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZEAny use? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
MikahS Posted October 23, 2014 Author Posted October 23, 2014 Any use? M23 You are one smart cookie Melba It works perfectly as expected. Only, one minor detail. If the window is maximized it will stay the same, and will only change sizes when you are manually resizing the window. Any thoughts? Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
Moderators Melba23 Posted October 23, 2014 Moderators Posted October 23, 2014 MikahS, You are one smart cookie MelbaThanks. :blush:As to the "minor detail" - I suggest looking for the maximize and restore messages and running the same function when they occur. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
MikahS Posted October 23, 2014 Author Posted October 23, 2014 (edited) I tried using GUIRegisterMsg($WM_SYSCOMMAND, 'WM_SIZE'). It does the same behavior for maximizing, but tries to expand everything when it is then restored. I must be missing something.. EDIT: Also tried GUIRegisterMsg(0xF030, "WM_SIZE") GUIRegisterMsg(0xF020, "WM_SIZE") GUIRegisterMsg(0xF120, "WM_SIZE") Edited October 23, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
Moderators Solution Melba23 Posted October 23, 2014 Moderators Solution Posted October 23, 2014 MikahS,Try this - you need to wait until the window has been maximized/restored before you resize which is why I use a flag in the idle loop: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiScrollBars.au3> #include <GUIListViewEx.au3> #include <EditConstants.au3> Local $List1, $List2, $List3, $List4, $lp_Buffer = 0 Local $List1Ex, $List2Ex, $List3Ex Global $GUIhandle, $cLabel_1, $cLabel_2, $cLabel_3 Global $bSysMsg = False GUI() GUIRegisterMsg($WM_SIZE, "_WM_SIZE") GUIRegisterMsg($WM_SYSCOMMAND, "_WM_SYSCOMMAND") _GUIScrollBars_EnableScrollBar(ControlGetHandle("", "", $List2), $SB_BOTH, $ESB_DISABLE_BOTH) _GUIScrollBars_EnableScrollBar(ControlGetHandle("", "", $List3), $SB_BOTH, $ESB_DISABLE_BOTH) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Quit() EndSwitch If $bSysMsg Then $bSysMsg = False _Resize_ListViews() EndIf WEnd ;END MAIN LINE Func Quit() Exit EndFunc ;==>Quit Func GUI() Local $Index, $LV1, $LV2, $LV3 $GUIhandle = GUICreate("tester", 680, 575, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX) ;creates the parent window ;GUICtrlSetResizing(-1, $GUI_DOCKAUTO) ;;allows resizing of full window $List1 = _GUICtrlListView_Create($GUIhandle, "Computer Name", 20, 35, 300, 448, -1, $LVS_EX_DOUBLEBUFFER) ;;$ES_READONLY incase you don't want to be able to select text _GUICtrlListView_SetExtendedListViewStyle($List1, $LVS_EX_TWOCLICKACTIVATE) $cLabel_1 = GUICtrlCreateLabel("", 20, 35, 300, 448) GUICtrlSetState($cLabel_1, $GUI_DISABLE) GUICtrlSetResizing($cLabel_1,$GUI_DOCKAUTO ) GUICtrlSetBkColor($cLabel_1, $GUI_BKCOLOR_TRANSPARENT) $List2 = _GUICtrlListView_Create($GUIhandle, "Date/Time", 355, 35, 190, 450, -1, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FLATSB)) $cLabel_2 = GUICtrlCreateLabel("", 355, 35, 190, 450) GUICtrlSetState($cLabel_2, $GUI_DISABLE) GUICtrlSetResizing($cLabel_2,$GUI_DOCKAUTO ) GUICtrlSetBkColor($cLabel_2, $GUI_BKCOLOR_TRANSPARENT) $List3 = _GUICtrlListView_Create($GUIhandle, "Speed", 574, 35, 95, 450, -1, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FLATSB)) $cLabel_3 = GUICtrlCreateLabel("", 574, 35, 95, 450) GUICtrlSetState($cLabel_3, $GUI_DISABLE) GUICtrlSetResizing($cLabel_3,$GUI_DOCKAUTO ) GUICtrlSetBkColor($cLabel_3, $GUI_BKCOLOR_TRANSPARENT) GUICtrlCreateLabel("Additional Info", 20, 489) ;creates the label for $List4 GUICtrlSetResizing(-1, $GUI_DOCKSIZE) $List4 = GUICtrlCreateList("", 20, 512, 635, 40, BitOR($WS_BORDER, $WS_VSCROLL), $ES_READONLY) GUICtrlSetResizing($List4, $GUI_DOCKAUTO) GUICtrlCreateLabel("Active Connections: ", 525, 487) ;creates the label for the active connections GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUISetState(@SW_SHOW) ;shows the GUI window For $Index = 0 To 100 Step 1 $LV1 = _GUICtrlListView_AddItem($List1, " ") ;adds a default value into $List1 $LV2 = _GUICtrlListView_AddItem($List2, " ") ;adds a default value into $List2 $LV3 = _GUICtrlListView_AddItem($List3, " ") ;adds a default value into $List3 Next EndFunc ;==>GUI Func _WM_SIZE($hWnd, $msg, $wParam, $lParam) _Resize_ListViews() Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE Func _WM_SYSCOMMAND($hWnd, $msg, $wParam, $lParam) Const $SC_MAXIMIZE = 0xF030 Const $SC_RESTORE = 0xF120 Switch $wParam Case $SC_MAXIMIZE, $SC_RESTORE $bSysMsg = True EndSwitch EndFunc Func _Resize_ListViews() $aRet = ControlGetPos($GUIhandle, "", $cLabel_1) WinMove($List1, "", $aRet[0], $aRet[1], $aRet[2], $aRet[3]) $aRet = ControlGetPos($GUIhandle, "", $cLabel_2) WinMove($List2, "", $aRet[0], $aRet[1], $aRet[2], $aRet[3]) $aRet = ControlGetPos($GUIhandle, "", $cLabel_3) WinMove($List3, "", $aRet[0], $aRet[1], $aRet[2], $aRet[3]) EndFuncM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
MikahS Posted October 23, 2014 Author Posted October 23, 2014 Ah, hit the nail square on the head. Thank you for all your help Melba! As always, much appreciated. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
Moderators Melba23 Posted October 23, 2014 Moderators Posted October 23, 2014 MikahS,My pleasure as always. M23 MikahS 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
AckerMAN Posted April 24, 2018 Posted April 24, 2018 On 23.10.2014 at 10:32 PM, Melba23 said: MikahS, Try this - you need to wait until the window has been maximized/restored before you resize which is why I use a flag in the idle loop: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiScrollBars.au3> #include <GUIListViewEx.au3> #include <EditConstants.au3> Local $List1, $List2, $List3, $List4, $lp_Buffer = 0 Local $List1Ex, $List2Ex, $List3Ex Global $GUIhandle, $cLabel_1, $cLabel_2, $cLabel_3 Global $bSysMsg = False GUI() GUIRegisterMsg($WM_SIZE, "_WM_SIZE") GUIRegisterMsg($WM_SYSCOMMAND, "_WM_SYSCOMMAND") _GUIScrollBars_EnableScrollBar(ControlGetHandle("", "", $List2), $SB_BOTH, $ESB_DISABLE_BOTH) _GUIScrollBars_EnableScrollBar(ControlGetHandle("", "", $List3), $SB_BOTH, $ESB_DISABLE_BOTH) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Quit() EndSwitch If $bSysMsg Then $bSysMsg = False _Resize_ListViews() EndIf WEnd ;END MAIN LINE Func Quit() Exit EndFunc ;==>Quit Func GUI() Local $Index, $LV1, $LV2, $LV3 $GUIhandle = GUICreate("tester", 680, 575, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX) ;creates the parent window ;GUICtrlSetResizing(-1, $GUI_DOCKAUTO) ;;allows resizing of full window $List1 = _GUICtrlListView_Create($GUIhandle, "Computer Name", 20, 35, 300, 448, -1, $LVS_EX_DOUBLEBUFFER) ;;$ES_READONLY incase you don't want to be able to select text _GUICtrlListView_SetExtendedListViewStyle($List1, $LVS_EX_TWOCLICKACTIVATE) $cLabel_1 = GUICtrlCreateLabel("", 20, 35, 300, 448) GUICtrlSetState($cLabel_1, $GUI_DISABLE) GUICtrlSetResizing($cLabel_1,$GUI_DOCKAUTO ) GUICtrlSetBkColor($cLabel_1, $GUI_BKCOLOR_TRANSPARENT) $List2 = _GUICtrlListView_Create($GUIhandle, "Date/Time", 355, 35, 190, 450, -1, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FLATSB)) $cLabel_2 = GUICtrlCreateLabel("", 355, 35, 190, 450) GUICtrlSetState($cLabel_2, $GUI_DISABLE) GUICtrlSetResizing($cLabel_2,$GUI_DOCKAUTO ) GUICtrlSetBkColor($cLabel_2, $GUI_BKCOLOR_TRANSPARENT) $List3 = _GUICtrlListView_Create($GUIhandle, "Speed", 574, 35, 95, 450, -1, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FLATSB)) $cLabel_3 = GUICtrlCreateLabel("", 574, 35, 95, 450) GUICtrlSetState($cLabel_3, $GUI_DISABLE) GUICtrlSetResizing($cLabel_3,$GUI_DOCKAUTO ) GUICtrlSetBkColor($cLabel_3, $GUI_BKCOLOR_TRANSPARENT) GUICtrlCreateLabel("Additional Info", 20, 489) ;creates the label for $List4 GUICtrlSetResizing(-1, $GUI_DOCKSIZE) $List4 = GUICtrlCreateList("", 20, 512, 635, 40, BitOR($WS_BORDER, $WS_VSCROLL), $ES_READONLY) GUICtrlSetResizing($List4, $GUI_DOCKAUTO) GUICtrlCreateLabel("Active Connections: ", 525, 487) ;creates the label for the active connections GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUISetState(@SW_SHOW) ;shows the GUI window For $Index = 0 To 100 Step 1 $LV1 = _GUICtrlListView_AddItem($List1, " ") ;adds a default value into $List1 $LV2 = _GUICtrlListView_AddItem($List2, " ") ;adds a default value into $List2 $LV3 = _GUICtrlListView_AddItem($List3, " ") ;adds a default value into $List3 Next EndFunc ;==>GUI Func _WM_SIZE($hWnd, $msg, $wParam, $lParam) _Resize_ListViews() Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE Func _WM_SYSCOMMAND($hWnd, $msg, $wParam, $lParam) Const $SC_MAXIMIZE = 0xF030 Const $SC_RESTORE = 0xF120 Switch $wParam Case $SC_MAXIMIZE, $SC_RESTORE $bSysMsg = True EndSwitch EndFunc Func _Resize_ListViews() $aRet = ControlGetPos($GUIhandle, "", $cLabel_1) WinMove($List1, "", $aRet[0], $aRet[1], $aRet[2], $aRet[3]) $aRet = ControlGetPos($GUIhandle, "", $cLabel_2) WinMove($List2, "", $aRet[0], $aRet[1], $aRet[2], $aRet[3]) $aRet = ControlGetPos($GUIhandle, "", $cLabel_3) WinMove($List3, "", $aRet[0], $aRet[1], $aRet[2], $aRet[3]) EndFunc M23 Very good, but there is no check for double-click on window title events. Here is the fix: Func _WM_SYSCOMMAND($hWnd, $msg, $wParam, $lParam) Const $SC_MAXIMIZE = 0xF030 Const $SC_RESTORE = 0xF120 ;Restore via double-click on title window Const $SC_RESTORE2 = 0xF122 ;Maximize via double-click on title window Const $SC_MAXIMIZE2 = 0xF032 Switch $wParam Case $SC_MAXIMIZE, $SC_RESTORE, $SC_RESTORE2, $SC_MAXIMIZE2 $bSysMsg = True EndSwitch EndFunc
Moderators Melba23 Posted April 24, 2018 Moderators Posted April 24, 2018 AckerMAN, Welcome to the AutoIt forums. Thanks for adding the extra code - I did not even know that you could do that! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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