Moderators Melba23 Posted May 27, 2016 Author Moderators Share Posted May 27, 2016 [NEW VERSION] - 27 May 16 Added: Ability to choose HotKey to begin editing an item via new _GUIListViewEx_SetEditKey function New zip in first post. M23 JLogan3o13 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 Link to comment Share on other sites More sharing options...
dmob Posted May 30, 2016 Share Posted May 30, 2016 (edited) Please disregard, found the problem.. Edited May 30, 2016 by dmob Link to comment Share on other sites More sharing options...
bourny Posted May 31, 2016 Share Posted May 31, 2016 Melba23, I have a problem when using _GUICtrlListView_SetColumnWidth. If I set one of the many columns to exceed the size of the _GUICtrlListView_Create window the nice border that is wrapping the listview gets disrupted and ends up with loads of gaps. It seems to correct itself if I move to a different Tab and come back to the offending tab. The same occurs if I resize a column past the width of the listview window. I am looking for a way to stop this bad behaviour. I need to allow the users to resize past the size of the list view which automatically brings in the horizontal scroll bar that works well. I may need to simply trigger a refresh using onevent capture of a column resize. any ideas how I can get around the problem or if you have seen this behaviour before. Many Thanks Link to comment Share on other sites More sharing options...
Inpho Posted June 1, 2016 Share Posted June 1, 2016 (edited) Thanks for this; it's amazing! 2 gripes, 1. Sorting works fine on the first listview I populate, but then when I re-populate the same listview with different data, sorting misbehaves. It tries to sort the data which was originally in the listview; instead of the new data (code below). 2. The sorting has no option to sort numerically, so I replaced the Arraysort inside __GUIListViewEx_ColSort with _ArraySortMulti. This isn't related to/doesn't cause the above issue. $aDataCheatSheet = IniReadSection("O2.ini", "SDB") _ArrayDelete($aDataCheatSheet, 0) $hListView_Right = _GUICtrlListView_Create($hGUI, "QID|Text|Title", 10, 500, 1000, 147, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT, $WS_BORDER)) _GUICtrlListView_SetExtendedListViewStyle($hListView_Right, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP)) _GUICtrlListView_SetColumnWidth($hListView_Right, 0, 48) _GUICtrlListView_SetColumnWidth($hListView_Right, 1, 800) _GUICtrlListView_SetColumnWidth($hListView_Right, 2, 130) _GUICtrlListView_SetInsertMarkColor($hListView_Right, 0) For $i = 0 To UBound($aDataCheatSheet) - 1 $aTextData = StringSplit($aDataCheatSheet[$i][1], "|") _GUICtrlListView_AddItem($hListView_Right, $aDataCheatSheet[$i][0]) _GUICtrlListView_AddSubItem($hListView_Right, $i, $aTextData[1], 1) _GUICtrlListView_AddSubItem($hListView_Right, $i, $aTextData[2], 2) Next $aLV_List_Right = _GUIListViewEx_ReadToArray($hListView_Right, 0) $iLV_Right_Index = _GUIListViewEx_Init($hListView_Right, $aLV_List_Right, 0, 0x00FF00, Default, 1) _GUIListViewEx_SetEditStatus($iLV_Right_Index, "*", 1) ^This sorting works fine, but when I re-populate like this: _GUICtrlListView_DeleteAllItems($hListView_Right) $aDataCheatSheet = IniReadSection($sDefaultCsdb, $sDefaultCsType) _ArrayDelete($aDataCheatSheet, 0) For $i = 1 To UBound($aDataCheatSheet) - 1 $aTextData = StringSplit($aDataCheatSheet[$i][1], "|") _GUICtrlListView_AddItem($hListView_Right, $aDataCheatSheet[$i][0]) _GUICtrlListView_AddSubItem($hListView_Right, $i - 1, $aTextData[1], 1) _GUICtrlListView_AddSubItem($hListView_Right, $i - 1, $aTextData[2], 2) Next Sorting no longer works properly. .ini format: [SDB] 1=Test1|One 2=Test2|Two 10=Test10|Ten 100=Test100|OneHundred 200=Test200|TwoHundred 1000=Test1000|OneThousand Is there another way to re-populate the listview in a way that sorting recognises? Edited June 1, 2016 by Inpho Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 1, 2016 Author Moderators Share Posted June 1, 2016 Inpho, Not only do you have to delete all the items in the ListView, you need to remove it from the UDF and then re-initialise it as explained in this post from the previous UDF thread. That way you purge the original shadow array and the UDF will then sort the new one. Let me know if that does not work and let me see the code you used. bourny, Looking into the matter - but as I will have to write all the code myself it might take a while (hint: provide your own reproducer script and things go faster). M23 Inpho 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 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 1, 2016 Author Moderators Share Posted June 1, 2016 bourny, I wrote this simple script using the latest version of the UDF and I see no problem with the edits messing with the border when the columns are wider then the ListView itself: expandcollapse popup#include <GUIConstantsEx.au3> #include <GUIListViewEx.au3> Global $aContent[5] $hGUI = GUICreate("Test", 500, 500) $cTab = GUICtrlCreateTab(10, 10, 480, 480) $cTab_0 = GUICtrlCreateTabItem("Tab 0") $cLV = GUICtrlCreateListView("Col 0|Col 1", 30, 50, 350, 350) _GUICtrlListView_SetColumnWidth($cLV, 0, 250) _GUICtrlListView_SetColumnWidth($cLV, 1, 550) ; Column wider than ListView <<<<<<<<<<<<<<<<<<<<<<<<<<< For $i = 0 To 4 $aContent[$i] = "Item " & $i & "-0|Item " & $i & "-1" GUICtrlCreateListViewItem($aContent[$i], $cLV) Next $iLV_Index = _GUIListViewEx_Init($cLV, $aContent) _GUIListViewEx_SetEditStatus($iLV_Index, "1") ; Wide column editable <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $cTab_1 = GUICtrlCreateTabItem("Tab 1") GUICtrlCreateTabItem("") GUISetState() _GUIListViewEx_MsgRegister() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch _GUIListViewEx_EditOnClick() WEnd So I need a reproducer script from you if you want me to look into this further. 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...
Sturmi Posted June 1, 2016 Share Posted June 1, 2016 Need help with it I need to columns with headers and grid. the right side needs to be editable and the left one constant.. also need to read those cells on right then . Can someone drop me a example ? Cant get Listview any near what i need. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 1, 2016 Author Moderators Share Posted June 1, 2016 Sturmi, What code have you tried that does not work? Post that and I will see how it might be tweaked. 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...
Sturmi Posted June 1, 2016 Share Posted June 1, 2016 7 minutes ago, Melba23 said: Sturmi, What code have you tried that does not work? Post that and I will see how it might be tweaked. M23 Deleted the other one but i wasnt far into it anyways. $hGUI2 = GUICreate("Form1", 258, 442, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 8, 384, 243, 25, $WS_GROUP) $List1 = GUICtrlCreateListView("", 8, 8, 241, 357) GUICtrlCreateListViewItem("test|test2",$List1) $Label2 = GUICtrlCreateLabel("Label2", 8, 416, 36, 17) GUISetState(@SW_SHOW) thats my gui. I have no clue how to make left side constant , right editable, read those values from right and make it not resizeable Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 1, 2016 Author Moderators Share Posted June 1, 2016 Sturmi, Not too difficult to fix: expandcollapse popup#include <GUIConstantsEx.au3> #include <Array.au3> #include <GUIListViewEx.au3> $hGUI2 = GUICreate("Form1", 258, 442, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 8, 384, 243, 25) $List1 = GUICtrlCreateListView("Col 1|Col 2", 8, 8, 241, 357) GUICtrlCreateListViewItem("test1|test2", $List1) $Label2 = GUICtrlCreateLabel("Label2", 8, 416, 36, 17) GUISetState(@SW_SHOW) ; Read ListView content into an array $aContent = _GUIListViewEx_ReadToArray($List1) ; Initiate ListView $iLV_Index = _GUIListViewEx_Init($List1, $aContent) ; Set column 1 as editable _GUIListViewEx_SetEditStatus($iLV_Index, 1) ; Register required messages _GUIListViewEx_MsgRegister() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button1 ; Read content of ListView $aReadContent = _GUIListViewEx_ReturnArray($iLV_Index) ; Display content _ArrayDisplay($aReadContent, "ListView", Default, 8) EndSwitch ; Allow ListView editing _GUIListViewEx_EditOnClick() WEnd Might I suggest reading the guide to the UDF that I added to the zip file which explains in some detail how to use it. M23 Sturmi 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 Link to comment Share on other sites More sharing options...
Sturmi Posted June 1, 2016 Share Posted June 1, 2016 (edited) 10 minutes ago, Melba23 said: <snip> thanks alot for quick and good solution for it ! Do you know a way to disable the column resizing ? Edited June 1, 2016 by Melba23 Removed quote Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 1, 2016 Author Moderators Share Posted June 1, 2016 Sturmi, Take a look at this post. M23 P.S. When you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unnecessarily. Sturmi 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 Link to comment Share on other sites More sharing options...
Sturmi Posted June 1, 2016 Share Posted June 1, 2016 Thought ipb only has quotes are user marking. I'll do in future . thanks Link to comment Share on other sites More sharing options...
Sturmi Posted June 1, 2016 Share Posted June 1, 2016 added grids now and seems like the edit doesnt work anymore. @Melba23 thanks alot Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 1, 2016 Author Moderators Share Posted June 1, 2016 (edited) Sturmi, My crystal ball is off for repolishing at the moment, so let me see the code that you are now using. M23 Edit: I will look at adding a "fixed-width column" option to the UDF - thanks for the suggestion Edited June 1, 2016 by Melba23 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...
Inpho Posted June 1, 2016 Share Posted June 1, 2016 _GUIListViewEx_Close must have been the only thing I didn't try, thanks man. Would you be interested in adding a feature for setting a column to hold numeric data (for sorting)? I hate destroying these beautiful UDF's for random requirements Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 1, 2016 Author Moderators Share Posted June 1, 2016 Inpho, Delighted you got it working. The "alpha/numeric" sort question is one which often arises (and not only for this UDF) - I will have a think about how it might be implemented, but do not hold your breath. 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...
Inpho Posted June 1, 2016 Share Posted June 1, 2016 ArrayMultiSort is the only UDF I found that can sort numerically. I'll just use Number while adding listview items, not much finger work for me. When pressing Tab while editing the final cell in a row, I would expect it to move to the first column of the next row, if it exists. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 1, 2016 Author Moderators Share Posted June 1, 2016 (edited) Inpho, Do not lose hope, I am looking at how to offer a choice: the standard _ArraySort function by default, or a user-defined algorithm as long as it will accept similar parameters. Quote When pressing Tab while editing the final cell in a row, I would expect it to move to the first column of the next row, if it exists. A design choice - I have set it up so that it either exits, stays in place, or loops back to the first column - depending on the value of the $iEditMode parameter passed to _GUIListViewEx_EditOnClick. If you want something different - you code it! M23 Edited June 1, 2016 by Melba23 Typo 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...
Sturmi Posted June 1, 2016 Share Posted June 1, 2016 @Melba23 sorry for wasting your time! There you go expandcollapse popupFunc gui2() $hGUI2 = GUICreate("Form1", 258, 442, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 8, 384, 243, 25) $List1 = GUICtrlCreateListView("Data|Your Info", 8, 8, 241, 357,-1,$LVS_EX_GRIDLINES) GUICtrlCreateListViewItem(" | ", $List1) GUICtrlCreateListViewItem("Test1:| ", $List1) GUICtrlCreateListViewItem(" | ", $List1) GUICtrlCreateListViewItem("Test2: | ", $List1) GUICtrlCreateListViewItem(" | ", $List1) GUICtrlCreateListViewItem("Test3:| ", $List1) GUICtrlCreateListViewItem(" | ", $List1) GUICtrlCreateListViewItem("Test5:| ", $List1) _GUICtrlListView_SetColumnWidth($List1, 0, 117) _GUICtrlListView_SetColumnWidth($List1, 1, 117) $Label2 = GUICtrlCreateLabel("Label2", 8, 416, 36, 17) GUISetState(@SW_SHOW) ; Read ListView content into an array $aContent = _GUIListViewEx_ReadToArray($List1) ; Initiate ListView $iLV_Index = _GUIListViewEx_Init($List1, $aContent) ; Set column 1 as editable _GUIListViewEx_SetEditStatus($iLV_Index, 1) ; Register required messages _GUIListViewEx_MsgRegister() ControlDisable($hGUI2, "", HWnd(_GUICtrlListView_GetHeader($List1))) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete($hGUI2) ExitLoop Case $Button1 ; Read content of ListView $aReadContent = _GUIListViewEx_ReturnArray($iLV_Index) ; Display content _ArrayDisplay($aReadContent, "ListView", Default, 8) EndSwitch ; Allow ListView editing WEnd _GUIListViewEx_EditOnClick() EndFunc 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