Jump to content

GUIListViewEx Integration


 Share

Recommended Posts

  • Moderators

error471,

Here is my take on the "save/load" functions:

<snip>

Try altering the data/colour of the LH ListView and then loading the RH one with a save/load cycle - works nicely for me, how about you?

As always, please ask if you have any questions.

M23

Edited by Melba23
Beta code removed

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 comment
Share on other sites

  • Moderators

error471,

Good to hear. I think I might add these "load/save" functions to the UDF proper, which will also allow me to streamline them a little.

Any other requests - or are you done for a while?

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 comment
Share on other sites

Well, indeed, there is a matter. The script is fine, when the program starts with manually set columns. But when I start an empty GUIListView (or at least with one column), the loading function does not work properly, which means It only loads the first column. I kindly think that this is something that needs to be fixed.

A potential luxury-request is, saving/loading of the column headers into the lvs, plus (overkill) editable column headers as well as addable columns (like add row function).

Dude I salute you for your efforts.

Edited by error471
Link to comment
Share on other sites

  • Moderators

error471,

Quote

when I start an empty GUIListView (or at least with one column), the loading function does not work properly

Thanks, I will look into that. [Works for me as long as the empty ListView has the correct number of columns] [Now it works for all column values]

Quote

saving/loading of the column headers

That should not be too difficult. [Done]

Quote

(overkill) editable column headers

Go and read the function header for _GUIListViewEx_Init - that functionality is already incorporated in the UDF.

Quote

addable columns

That might be a bit more difficult as there is no native function on which to base the functionality. I will take a look, but only after I get the rest of it working (and you are not the only one looking for changes to this particular UDF). [I was wrong: there is a UDF function, but I am struggling to see how to implement it sensibly]

M23

Edit 3: Do you see the "add column" functionality to work only when loading saved data (already done), or more generally?

Edited by Melba23
Update 2 - see [...] sections

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 comment
Share on other sites

@Melba23:

Thank you. I will check the improvements as soon as I am home tonight.

Concerning the "add column", I was thinking of a general "add column" button, which adds a column at the right-end, despite the load column function while loading.

Some maybe nice-to-have ideas: For my special needs, there is no need to add a column in between two existent columns, but it could be nice anyway. Thinking about this, selectable "boxes" similar to Excel, instead of an entire selected row, could maybe improve the GUIListView. A custom assignable, transparent colour of the selected row, could improve the standard blue highlighting, which simply overlays everything.

Edited by error471
Link to comment
Share on other sites

  • Moderators

error471,

I have not posted the new code yet, so no rush.

As to the requests, all of them would further complicate the code, so I am not overly keen to add them - and certainly not until I get the current changes properly integrated.

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 comment
Share on other sites

  • Moderators

error471,

Understood - I will look at the "add column" functionality when I next have time - probably tomorrow. In the meantime, here are the current files for you to test:

<snip>

I have integrated the "save/load" functions into the UDF, so there are a few syntax changes - the most important is that you need to initialise the empty ListView so that you have an identifying index to pass to the UDF. Most of the other changes I think are fairly obvious - normally simpler than before.

I am now trying hard to break this version - be my guest to come up with the edge cases I have not yet managed to imagine!

M23

Edited by Melba23
Beta code removed

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 comment
Share on other sites

@Melba23:

I think I might have found a bug: Whenever I load a defined lvs-file directly at the startup of my script, the colours are not shown immediately in the GUIListView. I have to click every single line to make it appear. Opening a file with the load-button or with an opening dialogue is no problem. The problem appears only once at the startup.

Another minor problem appears whenever I doubleclick into the GUIListView. It seems to open the editing function as it should, but then suddenly it cancels. I have to repeat this sometimes 2-3 times before being able to finally edit.

Edited by error471
Link to comment
Share on other sites

  • Moderators

error471,

Loading from start works for me - can you post a reproducer?

Looking at the edit problem now.

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 comment
Share on other sites

1 hour ago, Melba23 said:

Loading from start works for me - can you post a reproducer?

I found my mistake. Loading the LVS-file was before GUISetState().

Edit:

The other problem does not appear anymore, too.

 

Edited by error471
Link to comment
Share on other sites

Melba23,

is it possible to get the content, text colour and background color of a specific cell with _GUICtrlListView_GetTextColor or _GUICtrlListView_GetTextBkColor? What I am intending to do is a scan of for example every red content with yellow background in a specific row, and output its content into a variable or file.

error471

Edited by error471
Link to comment
Share on other sites

  • Moderators

error471,

Quote

Loading the LVS-file was before GUISetState().

You can load a file before GUISetState, but you must have already registered the WM_NOTIFY handler (usually via _GUIListViewEx_MsgRegister) before GUISetState so that the handler code can set the required colours when the GUI is displayed.

I see the failure to edit in double click occasionally - I believe it is due to the known propensity of ListViews to "eat" the odd click, so if your double-click is a little slow it is interpreted as 2 singles and only one of them actioned.

Quote

is it possible to get the content, text colour and background color of a specific cell 

You already have the ability to extract the colours in an array -  a wrapper function to parse that array will do what you require and I am certainly not adding such a functionality to the UDF. But I might look at it after I have sorted the "column add" code. And then, barring bugs, you will have exhausted your "feature request" account for some time to come!

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 comment
Share on other sites

1 hour ago, Melba23 said:

And then, barring bugs, you will have exhausted your "feature request" account for some time to come!

These two requests are certainly the last ones. This is a promise. I want to thank you for your efforts. Please check your private message inbox.

Link to comment
Share on other sites

  • Moderators

error471,

Thanks for your kind words - and here are the files to test the "column insert/delete" code (there are also a couple of other new functions in there as well but that need not concern you):

 

<snip>

Over to you - I am off to work on that cell colour wrapper.....

M23

Edited by Melba23
Removed Beta code

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 comment
Share on other sites

  • Moderators

error471,

And here it is:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <AutoItConstants.au3>
#include <File.au3>
#include <String.au3>
#include <Array.au3>

#include "GUIListViewEx_Colour_Col.au3"

$hGUI = GUICreate("Test", 1000, 500)

$cLV_1 = GUICtrlCreateListView("Fixed Title|Column 1|Column 2|Column 3|Column 4|Column 5", 10, 10, 480, 300, $LVS_SINGLESEL)
_GUICtrlListView_SetExtendedListViewStyle($cLV_1, BitOr($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
For $i = 0 To 5
    _GUICtrlListView_SetColumnWidth($cLV_1, $i, 70)
Next

; Create array and fill listview
Global $aLVArray_1[6][6]
For $i = 1 To 5
    $sData = "Item " & $i - 1 & "-0"
    $aLVArray_1[$i][0] = $sData
    For $j = 1 To 5
        $sData &= "|SubItem " & $i - 1 & "-" & $j
        $aLVArray_1[$i][$j] = "SubItem " & $i - 1 & "-" & $j
    Next
    GUICtrlCreateListViewItem($sData, $cLV_1)
Next

; Initiate ListView - edit on click in columns 1-5 - user colours
$iLVIndex_1 = _GUIListViewEx_Init($cLV_1, $aLVArray_1, 1, 0, True, 2 + 16 + 32, "1-5")

; Create colour array - must be 0-based - RGB hex "text;back" - "" or ";" if default
Global $aColArray_1[5][6] = [["", "", "0xFFFF00;0xFF0000"], _
                            [], _
                            ["", "0xFFFF00;0xFF0000", "", "0xFFFF00;0x08FF00", "", ";0xFF0000"], _
                            [], _
                            ["", "", "", "0xFFFF00;0xFF0000", "", "0xFFFF00;0xFF0000"]]
; Load colour array
_GUIListViewEx_LoadColour($iLVIndex_1, $aColArray_1)

; Create buttons
$cGo = GUICtrlCreateButton("Go!", 10, 450, 80, 30)

_GUIListViewEx_MsgRegister()

GUISetState()

While 1

    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $cGo
            ; Get colour array
            $aColArray = _GUIListViewEx_ReturnArray($iLVIndex_1, 2)
            ; Loop through array
            For $i = 0 To UBound($aColArray) - 1
                $sItems = "Row " & $i & " = "
                For $j = 1 To UBound($aColArray, 2) - 1
                    ; Is this cell yellow text on red field?
                    If $aColArray[$i][$j] = "0xFFFF00;0xFF0000" Then
                        $sItems &= $j & ";"
                    EndIf
                Next
                ConsoleWrite(StringTrimRight($sItems, 1) & @CRLF)
            Next

    EndSwitch

    ; Allow edit on double click
    $aRet = _GUIListViewEx_EditOnClick()

WEnd

Will that do what you require?

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 comment
Share on other sites

@Melba23:

Column insert/delete works. Awesome!

 

I changed the last code a bit. I meant it like this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <AutoItConstants.au3>
#include <File.au3>
#include <String.au3>
#include <Array.au3>

#include "GUIListViewEx_Colour_Col.au3"

$hGUI = GUICreate("Test", 1000, 500)

$cLV_1 = GUICtrlCreateListView("Fixed Title|Column 1|Column 2|Column 3|Column 4|Column 5", 10, 10, 480, 300, $LVS_SINGLESEL)
_GUICtrlListView_SetExtendedListViewStyle($cLV_1, BitOr($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
For $i = 0 To 5
    _GUICtrlListView_SetColumnWidth($cLV_1, $i, 70)
Next

; Create array and fill listview
Global $aLVArray_1[6][6]
For $i = 1 To 5
    $sData = "Item " & $i - 1 & "-0"
    $aLVArray_1[$i][0] = $sData
    For $j = 1 To 5
        $sData &= "|SubItem " & $i - 1 & "-" & $j
        $aLVArray_1[$i][$j] = "SubItem " & $i - 1 & "-" & $j
    Next
    GUICtrlCreateListViewItem($sData, $cLV_1)
Next

; Initiate ListView - edit on click in columns 1-5 - user colours
$iLVIndex_1 = _GUIListViewEx_Init($cLV_1, $aLVArray_1, 1, 0, True, 2 + 16 + 32, "1-5")

; Create colour array - must be 0-based - RGB hex "text;back" - "" or ";" if default
Global $aColArray_1[5][6] = [["", "", "0xFFFF00;0xFF0000"], _
                            [], _
                            ["", "0xFFFF00;0xFF0000", "", "0xFFFF00;0x08FF00", "", ";0xFF0000"], _
                            [], _
                            ["", "", "", "0xFFFF00;0xFF0000", "", "0xFFFF00;0xFF0000"]]
; Load colour array
_GUIListViewEx_LoadColour($iLVIndex_1, $aColArray_1)

; Create buttons
$cGo = GUICtrlCreateButton("Go!", 10, 450, 80, 30)

_GUIListViewEx_MsgRegister()

GUISetState()

While 1

    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $cGo
            ; Get colour array
            $aColArray = _GUIListViewEx_ReturnArray($iLVIndex_1, 2)
            ; Loop through array
            For $i = 0 To UBound($aColArray) - 1
                $sItems = "Row " & $i & " = "
                For $j = 1 To UBound($aColArray, 2) - 1
                    ; Is this cell yellow text on red field?
                    If $aColArray[$i][$j] = "0xFFFF00;0xFF0000" Then
                        $sItems &= $aLVArray_1[$i+1][$j] & "+"
                    EndIf
                Next
                ConsoleWrite(StringTrimRight($sItems, 1) & @CRLF)
            Next

    EndSwitch

    ; Allow edit on double click
    $aRet = _GUIListViewEx_EditOnClick()

WEnd

 

It works now as I wanted.

Link to comment
Share on other sites

  • Moderators

error471,

Great - nice to see a satisfied customer! And it was a fun few days getting it all to work, so thanks to you too.

I will polish the code a bit more over the next few days (i.e. making the default for the *ColSpec functions the rightmost column) - so keep an eye on the main UDF thread for a new release.

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 comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...