Moderators Melba23 Posted March 27, 2021 Author Moderators Share Posted March 27, 2021 [NEW VERSION] - 27 Mar 21 Added: - A new function _GUIListViewEx_SelectItem which allows you to select a row programatically - and also select the column if single cell selection is available. - The ability to select a background colour for the input that appears when editing an item. This colour is set in the array passed to _GUIListViewEx_SetDefColours which now must have 5 elements. This is a script-breaking change if you use this function - although all you have to do if you do not want to have a custom colour is add a final "Default" element to the array, which is not too taxing! New zip file in the first post. M23 Loc 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...
Bruceway Posted April 5, 2021 Share Posted April 5, 2021 Hi Melba23 - Is it possible to have a right click context menu in this UDF? I'm having issues understanding how to implement. Thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 6, 2021 Author Moderators Share Posted April 6, 2021 (edited) Bruceway, As Example 6 in the download zip shows, you can get a right click context menu quite easily. The menu is created between lines #75-91 and the menu item event activation is at lines #278-280. The _SetColour function at line #312 shows how to determine which item was right-clicked (using _GUIListViewEx_ContextPos) M23 Edited April 6, 2021 by Melba23 Correct line numbers! 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...
Bruceway Posted April 6, 2021 Share Posted April 6, 2021 Saw Line 75 ; Create context menu for native ListView and assumed it was only applying to the original ListView. Have grabbed the code and got it functioning, cheers. That will teach me to RTFM properly.. Link to comment Share on other sites More sharing options...
Mbee Posted April 13, 2021 Share Posted April 13, 2021 Praise to @Melba23! I can't tell you how grateful I am for the GUIListViewEx Guide! I definitely needed it, and it's well written too! Wonderful NassauSky 1 Link to comment Share on other sites More sharing options...
novel Posted July 31, 2021 Share Posted July 31, 2021 Thanks, for this great UDF!!! Is it possible to have internal drag/drop prevention? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 31, 2021 Author Moderators Share Posted July 31, 2021 novel, From the function header: ; #FUNCTION# ========================================================================================================= ; Name...........: _GUIListViewEx_Init ... ; $iAdded - 0 - No added features (default). To get added features add any of the following values ... ; + 64 - No external drag ; + 128 - No external drop ; + 256 - No delete on external drag/drop ; + 512 - No internal or external drag/drop ... Are those not sufficient? M23 Loc 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...
novel Posted July 31, 2021 Share Posted July 31, 2021 In my situation, i have 2 listviews, 1 in the right and 1 in the left, I want to be able to transfer items from the list1 to list 2 List 2 can be arranged as the user wishes but i don't want them to change the arrangement of the list 1. None of the options provided helps me with it, i couldnt figure out a way other than when the internal drag/drop happens i will force refresh the list with _GUIListViewEx_EventMonitor function of the UDF but i dont want to let the user be able to change it in the first place. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 31, 2021 Author Moderators Share Posted July 31, 2021 novel, I see - allow external but not internal drag/drop. I will take a look at the code and see if I can come up with something - but I am looking after my grandchildren at the moment, so I do not have a lot of time. Please be patient. 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...
novel Posted July 31, 2021 Share Posted July 31, 2021 Take your time, its really a useful UDF, dont rush im just scriptting for fun Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 2, 2021 Author Moderators Share Posted August 2, 2021 novel, Finally found a few spare moments - grandchildren just eat up your days! Please try this code and see if it meets your requirement: GUIListViewEx_Mod.au3 I have changed the functionality of $iAdded + 512 to limit it to preventing internal drag/drop only - external drag/drop is still permitted. If you want no drag/drop at all you need to use $iAdded + 64 + 128 + 512. Script breaking I know, but it seemed the logical way to proceed. M23 Loc 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...
novel Posted August 2, 2021 Share Posted August 2, 2021 Thank you for the modification, Right now i tried to put it to my script but strangely i couldn't use drag/drop between my lists even with original UDF, I need to figure out what's going on first, i'm tired from the work, i dont have much focus power left. I will try to give feedback when i figure it out. Thank you!!!! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 3, 2021 Author Moderators Share Posted August 3, 2021 novel, See if this example works for you: GLVEx_D-D_Example.au3 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...
jimmy123j Posted August 4, 2021 Share Posted August 4, 2021 (edited) Sorry for bother, I've 2 question 1. How can I make the dash line not show after Listview be selected another script to use the ListviewEx the dash line not show, but I check the code, both of 2 script without different for listview GUI created I still can't understand why ... 2. Listview index will duplicate on multiple windows (include child window) Step 1 (Opne 2nd Windows can see the selection is User color, and keep visible) > Step 2 (2nd Listview ini will invalid) Step 1 (Opne 2nd Windows right click and Edit will work) > Step 2 (2nd Windows right click and Edit will error or Edit window 1 Listview) I check the error, the 1st and 2nd Windows Index (duplication) distributed the same Index to 2 Listview, and cause to error I need to create multile child GUI windows and add Listview for different purpose expandcollapse popup; =========================================================================================================================================== #include <Array.au3> #include <Date.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <GuiStatusBar.au3> #include <WindowsConstants.au3> #include <GuiDateTimePicker.au3> #include <GuiListView.au3> #include <GUIListViewEx.au3> #include <ListViewConstants.au3> ; =========================================================================================================================================== Global $Tool_Temp Global $List_Default_Color[5] = ["", "", "0xFFFFFF", "0xFFA247", "0xFF00FF"] ; =========================================================================================================================================== $Main_UI = GUICreate("Window 1", 550, 300, -1, -1, $WS_SIZEBOX + $WS_MINIMIZEBOX) GUISetBkColor(0xFFFFFF, $Main_UI) ; =========================================================================================================================================== Global $Window1_List, $Window1_Array, $Window1_Index $Windows1_Button_1 = GUICtrlCreateButton("Step 1", 430, 110, 100, 30) $Windows1_Button_2 = GUICtrlCreateButton("Step 2", 430, 50, 100, 30) $Window1_List = GUICtrlCreateListView("AAAA|BBBB|CCCC|DDDD", 0, 20, 400, 200, $LVS_REPORT + $LVS_SINGLESEL, $LVS_EX_FULLROWSELECT + $WS_EX_CLIENTEDGE) ; =========================================================================================================================================== Global $Window2_List,$Window2_Array, $Window2_Index $Window2_UI = GUICreate("2nd Windows", 400, 200, -1, -1, $WS_SIZEBOX, -1, $Main_UI) $Window2_List = GUICtrlCreateListView("Item 1|Item 2|Item 3|Item 4|Item 5", 0, 0, 400, 200, $LVS_REPORT + $LVS_SINGLESEL, $LVS_EX_FULLROWSELECT + $WS_EX_CLIENTEDGE) $Window2_Menu = GUICtrlCreateContextMenu($Window2_List) $Window2_Edit = GUICtrlCreateMenuItem("Edit", $Window2_Menu) ; =========================================================================================================================================== _GUIListViewEx_MsgRegister() GUISetState(@SW_SHOW, $Main_UI) ; =========================================================================================================================================== While 1 ; ======================================================================================================================================== $UIGet = GUIGetMsg(1) Switch $UIGet[1] ; ================================================================================================================================== Case $Main_UI Switch $UIGet[0] Case $GUI_EVENT_CLOSE ExitLoop Case $Windows1_Button_2 Windows1_Script() Case $Windows1_Button_1 Windows2_Script() GUISetState(@SW_SHOW, $Window2_UI) EndSwitch ; ================================================================================================================================== Case $Window2_UI Switch $UIGet[0] Case $GUI_EVENT_CLOSE GUISetState(@SW_HIDE, $Window2_UI) Case $Window2_Edit $Tool_Temp = StringSplit(_GUIListViewEx_GetLastSelItem($Window2_Index), "|") _GUIListViewEx_EditItem($Tool_Temp[1], $Tool_Temp[2], $Tool_Temp[3]) EndSwitch EndSwitch ; ======================================================================================================================================== Sleep(25) WEnd Exit ; =========================================================================================================================================== Func Windows1_Script() Local $First_Array[2][5] = [[1, 2, 3, 4, 5],[6, 7, 8, 9, 10]] _GUIListViewEx_Close($Window1_Index) _GUICtrlListView_DeleteAllItems($Window1_List) _GUICtrlListView_AddArray($Window1_List, $First_Array) $Window2_Index = _GUIListViewEx_Init($Window1_List, $First_Array, 0, Default, False, 1 + 32 + 512) _GUIListViewEx_SetDefColours($Window1_Index, $List_Default_Color) EndFunc ; =========================================================================================================================================== Func Windows2_Script() Local $lsms_Array[2][5] = [[1, 2, 3, 4, 5],[6, 7, 8, 9, 10]] _GUIListViewEx_Close($Window2_Index) _GUICtrlListView_DeleteAllItems($Window2_List) _GUICtrlListView_AddArray($Window2_List, $lsms_Array) $Window2_Index = _GUIListViewEx_Init($Window2_List, $lsms_Array, 0, Default, False, 1 + 2 + 32 + 512 + 1024) _GUIListViewEx_SetDefColours($Window2_Index, $List_Default_Color) EndFunc Edited August 4, 2021 by jimmy123j Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 5, 2021 Author Moderators Share Posted August 5, 2021 jimmy123j, I have no idea why the dotted lines appear in some cases and not others - I am still looking and if I find anything to solve the problem I will post it here. Still trying to understand the second question. 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...
pixelsearch Posted August 7, 2021 Share Posted August 7, 2021 (edited) Hi jimmy123j, I had the same issue with the dotted rectangle when the item is focused. @LarsJ provided a solution that worked fine for me and it seems to solve your problem too. 1) Running your original script, the focused item is surrounded with the dotted rectangle : 2) With the additional line of code (placed immediately after the listview creation), the dotted rectangle has gone : $Window2_List = GUICtrlCreateListView("Item 1|Item 2|Item 3|Item 4|Item 5", 0, 0, 400, 200, $LVS_REPORT + $LVS_SINGLESEL, $LVS_EX_FULLROWSELECT + $WS_EX_CLIENTEDGE) _GUICtrlListView_SetCallBackMask($Window2_List, 4) ; "disable state information about focused item" (LarsJ) . Can be useful (keep that line) Edited August 7, 2021 by pixelsearch robertocm, dmob, Musashi and 1 other 4 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 7, 2021 Author Moderators Share Posted August 7, 2021 pixelsearch, Nice! And kudos to LarsJ. 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...
jimmy123j Posted August 8, 2021 Share Posted August 8, 2021 (edited) Hi pixelsearchl, that's amazing, thanks for help !!! Hi Melba23, maybe my explain was not clear, I sorry I created 2 GUI, and both of 2 windows with _GUIListViewEx_Init listview control (2 index) but both of 2 listview had same index, and cause to listview function work abnormal or an error you can click step 1 button create window 2 listview, and then click step 2 create window 1 listview to try obviously the window 2 defaut color will change after window 1 listview created (step 2) operation gif image Edited August 8, 2021 by jimmy123j Edit Text Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 8, 2021 Author Moderators Share Posted August 8, 2021 jimmy123j, In your Windows1_Script function you are using $Window2_Index to store the returned ListView index. This is the same variable as you use on your Windows2_Script function when initialisong the second ListView - so your script only ever sees one index value. When I change the variable to $Window1_Index the script seems to work correctly. 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...
jimmy123j Posted August 9, 2021 Share Posted August 9, 2021 (edited) Hi Melba23, sorry my bad, this's the simulation script actually my script use the different variable to store the Window's 1/2 Index (I can't share original script, cause my company PIP rule, even the script I made, sorry) I double confirmed that variable store the Listview index, both of 2 windows are different and I edit the script to right variable $Window1_Index = _GUIListViewEx_Init($Window1_List, $First_Array, 0, Default, False, 1 + 32 + 512) still got error 12 hours ago, Melba23 said: jimmy123j, In your Windows1_Script function you are using $Window2_Index to store the returned ListView index. This is the same variable as you use on your Windows2_Script function when initialisong the second ListView - so your script only ever sees one index value. When I change the variable to $Window1_Index the script seems to work correctly. M23 Edited August 9, 2021 by jimmy123j 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