bourny Posted March 30, 2020 Share Posted March 30, 2020 Hi, I am using @Melba23 GuiListViewEx for my gui. I am having difficulty when resizing the column it causes the list view to look broken up until I refresh it. This will be down to the way I have coded the program however, I would like to put a quick work around in to detect when someone is resizing a column and force the refresh. Problem is I cannot detect the column being resized. I have tried using an example of the below code i found on the forum to see if I can detect the list view expansion which I can. I then tried to add some code to the GuiListViewEx to see if the same would work but did not. First code snippet below is a part I found on the forum. The second code snippet is from the GuiListViewEX I tried to add. expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <HeaderConstants.au3> ; The 0-based column to be disabled Global $iFix_Col, $hHeader _Main() Func _Main() Local Const $hGUI = GUICreate("ListView Fix Column Width", 400, 300) Local Const $hListView = GUICtrlCreateListView("Column 0|Column 1|Column 2|Column 3", 2, 2, 394, 268) $hHeader = _GUICtrlHeader_Create($hGUI) GUISetState(@SW_SHOWNORMAL) ; Prevent resizing of column 1 $iFix_Col = 1 GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam ; Get details of message Local Const $tNMHEADER = DllStructCreate($tagNMHEADER, $lParam) Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Local $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") Local Const $iCode2 = DllStructGetData($tNMHEADER, "Code") Switch $hWndFrom Case $hHeader Switch $iCode2 Case $WM_SETCURSOR Return True EndSwitch EndSwitch Switch $iCode2 Case $HDN_BEGINTRACKW ; Now get column being resized Local $iCol = DllStructGetData($tNMHEADER, "Item") ;If $iCol = $iFix_Col Then ; Prevent resizing ; Return True ;Else consolewrite("Detected Resize" & @lf) ; Allow resizing Return False ;EndIf EndSwitch EndFunc ;==>_WM_NOTIFY Here is Melba23`s function extract code which I unsuccessfully spliced the above detection for $HDN_BeginTrackw. I also tried changing it to $LVN_BeginTrackw (Guess) which also failed to detect the resize. Clearly I dont understand the DllStructGetData enough to splice this or add code to enable the drag detection. I also looked on Dr Google for some idea of what libraries are available but what I found I dont fully understand enough to add the correct code. expandcollapse popup; #FUNCTION# ========================================================================================================= ; Name...........: _GUIListViewEx_WM_NOTIFY_Handler ; Description ...: Windows message handler for WM_NOTIFY ; Syntax.........: _GUIListViewEx_WM_NOTIFY_Handler() ; Requirement(s).: v3.3 + ; Return values .: None ; Author ........: Melba23 ; Modified ......: ; Remarks .......: If a WM_NOTIFY handler already registered, then call this function from within that handler ; Example........: Yes ;===================================================================================================================== Func _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam ; Struct = $tagNMHDR and "int Item;int SubItem" from $tagNMLISTVIEW Local $tStruct = DllStructCreate("hwnd;uint_ptr;int_ptr;int;int", $lParam) If @error Then Return ; Check if enabled ListView or header For $iLV_Index = 1 To $aGLVEx_Data[0][0] If $aGLVEx_Data[$iLV_Index][0] = DllStructGetData($tStruct, 1) Then ExitLoop EndIf Next If $iLV_Index > $aGLVEx_Data[0][0] Then Return ; Not enabled Local $iCode = BitAND(DllStructGetData($tStruct, 3), 0xFFFFFFFF) ;-------------Added by Bourny Local Const $tNMHEADER = DllStructCreate($tagNMHEADER, $lParam) Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Local $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") Local Const $iCode2 = DllStructGetData($tNMHEADER, "Code") ;Switch $hWndFrom ; Case $hHeader ; Switch $iCode2 ; Case $WM_SETCURSOR ; Return True ; EndSwitch ;EndSwitch Switch $iCode2 Case $HDN_BEGINTRACKW ; Now get column being resized Local $iCol = DllStructGetData($tNMHEADER, "Item") ;If $iCol = $iFix_Col Then ; Prevent resizing ; Return True ;Else consolewrite("Detected Resize" & @lf) ; Allow resizing Return False ;EndIf EndSwitch ;-------------Added by Bourny Switch $iCode Case $NM_RCLICK $iIndex = _GUICtrlListView_GetSelectedIndices($hListView_Right) any help appreciated. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 30, 2020 Moderators Share Posted March 30, 2020 bourny, If I resize ListView columns when using my UDF I do not see any sort of "broken" display as you mention. Do you get this effect when resizing columns in Example 6 of the UDF download? 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 Link to comment Share on other sites More sharing options...
bourny Posted March 30, 2020 Author Share Posted March 30, 2020 Hi Melba23, It looks fine when I resize on example 6. I am absolutely sure this is something to do with the way I am rendering my Gui or the graphic attached to it. I am looking to create a simplified version of my core Gui to troubleshoot where its going wrong. For now I can cope with it until I get a chance to troubleshoot however I was hoping to put a quick fix in place for now which is to simply refresh the Gui if I detect someone has resized a column. Your list view is perfect for my needs and it will be my poor implementation that is causing this issue. Do you think there is a way to detect this extending of the column in your Mod. I am already making good use of your left click and right click detection to do things which is working well. bourny. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 30, 2020 Moderators Share Posted March 30, 2020 bourny, Looking into it. 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 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 30, 2020 Moderators Share Posted March 30, 2020 (edited) bourny, Try this version - I have modified Example_6 to show how it works through _GUIListViewEx_EventMonitor: M23 Edited June 14, 2020 by Melba23 Beta code removed 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 Link to comment Share on other sites More sharing options...
bourny Posted March 30, 2020 Author Share Posted March 30, 2020 Melba23, That worked on your code. I can now detect the column resize in example6. I am running an older version of your Mod (3.3 +) which looks like the Mod has been overhauled and a lot of functions have been deprecated. I will need to try and migrate my program to your new Mod to take advantage of the new feature. Thanks for the time working on this. bourny Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 30, 2020 Moderators Share Posted March 30, 2020 bourny, I have plenty of spare time at the moment - even my wife cannot think of enough jobs to fill ALL my day! So if you need help in getting your code to work with the UDF do not hesitate to ask. 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 Link to comment Share on other sites More sharing options...
bourny Posted April 3, 2020 Author Share Posted April 3, 2020 You are very kind Melba23. Thanks for the offer. Link to comment Share on other sites More sharing options...
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