Jump to content

GUIListViewEx - New Version 13 Sep 21


Recommended Posts

  • Moderators

[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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites
  • 2 weeks later...
  • Replies 605
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

[NEW VERSION] - 13 Sep 21 Changed:  - A small change to the $iAdded parameter value of 512 - this used to block ALL drag/drop operations, but now only blocks INTERNAL drag/drop. So to block

I've tested the header color example as 64 bit code on both Windows 7 and Windows 10. In both cases, it fails. There are no colors in the header. Then I've made a much smaller example that only c

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

Posted Images

  • Moderators
Posted (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 by Melba23
Correct line numbers!

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

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 post
Share on other sites
  • 3 months later...
  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

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 post
Share on other sites
  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites
  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

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 post
Share on other sites
  • Moderators

novel,

See if this example works for you: GLVEx_D-D_Example.au3

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

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 ...

image.png.c929b44193176c05793ac46906bd2da6.png

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

; ===========================================================================================================================================

#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 by jimmy123j
Link to post
Share on other sites
  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

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 :

1042877274_1-originalscript.png.8eb0f490d0bea53df052fe698a125481.png

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)

1251066045_2-_SetCallBackMask.png.a51619e06a4cf9e5f75411d2aa33dd76.png

Edited by pixelsearch
Link to post
Share on other sites
  • Moderators

pixelsearch,

Nice! And kudos to LarsJ.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

Hi pixelsearchl, that's amazing, thanks for help !!!

image.png.8283b3d7005f9e3a256888a3f5165e17.png

 

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 by jimmy123j
Edit Text
Link to post
Share on other sites
  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

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 by jimmy123j
Link to post
Share on other sites
  • Melba23 changed the title to GUIListViewEx - New Version 13 Sep 21

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...