Jump to content

GUIListViewEx - BugFix Version 6 Apr 24


Melba23
 Share

Recommended Posts

Either I don't understand what you mean by "redeclare the "_SetEditStatus" line for that row with the new list of items.", or you misunderstood my issue.

By redeclare you simply mean to call the _seteditstatus function correct? If so, I am doing that.

The "contents" of the combo box is not the issue, I am able to set the new "contents" of the combo box. The problem is, if a something was previously selected before calling _SetEditStatus, that selected option is still visible as the default selection. So the "content" of the combo box is new, but the previous selection is still showing in the listview. Attached image shows what I mean by "default selection"...give me the proper terminology if that is incorrect.

Screenshot (34).jpg

Link to comment
Share on other sites

  • Moderators

Champak,

Interesting, it seems that the current value of the cell only appears in the combo if you have asked the combo to open on edit. i will look into this.

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

  • 3 weeks later...
  • Moderators

Champak,

Sorry for the delay - real life got in the way, as it has a habit of doing from time to time.

Please try this Beta code and see if it meets your requirement. You have 2 additional parameters for combos when using _SetEditStatus which determine whether the existing content is shown in the combo or not and, if shown, whether it is selected or not. Have a play around with it and let me know what you think: 

Still looking at the array insertion problem.

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

Champak,

I think I have soved the array insertion problem too - let me know if it works for you too: GUIListViewEx_Test.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 comment
Share on other sites

The array insert seems to work so far, I haven't gotten any errors with what I've tried so far.

The _SetEditStatus fix doesn't seem to be working though. The previous entry on the edit remains even though the content of the combo is updated. I tried:

_GUIListViewEx_SetEditStatus($iLVIndex_1, $Col_OptionVal, 2, $aOptionValue, 2 + 4 )

_GUIListViewEx_SetEditStatus($iLVIndex_1, $Col_OptionVal, 2, $aOptionValue, 2 + 8 )

I did find a workaround though, I don't know why I didn't see it before, although it would have been better with your fix, I just set _GUICtrlListView_SetItemText ( $cLV_1, $sListV_Index, "", $Col_OptionVal) before calling _SetEditStatus.

Thanks.

 

I have one other issue. I added a function to my app to compensate for another issue and it caused your UDF to offset from the main listview as you can see in the image.

Screenshot (39).png

 

What I added is:

What in your udf can I edit to compensate for this?

 

EDIT: I found something in __GUIListViewEx_EditCoords and edited:

    $aEdit_Data[0] = DllStructGetData($tLVPos, "X") + $aRect[0] + $iDelta_X - 3
    $aEdit_Data[1] = DllStructGetData($tLVPos, "Y") + $aRect[1] + $iDelta_Y - 5

to get what I want. Just checking with you if that's the best place to get what I want.

 

Edited by Champak
Link to comment
Share on other sites

  • Moderators

Champak,

Array Insert: Glad to hear it works (so far)!

EditBox Content:

Try using: _GUIListViewEx_SetEditStatus($iLVIndex_1, $Col_OptionVal, 2, $aOptionValue, 2)

At present you are asking for the content to be shown - so hardly surprising that it is!  What I have coded in the Beta UDF works fine for me - so unless you can give me a working example to debug I am afraid that I can do no more.

- As to your workaround, I would advise using _GUIListViewEx_ChangeItem to empty the element - if you use a non-UDF function to do this, the internal UDF array will no longer match the actual ListView contents which could well end in tears if the edit is aborted. And do not forget to read the value you are deleting so that you can restore it (using _GUIListViewEx_ChangeItem again) if that is indeed the case.

Edit Position: You should use the $iDelta_X and $iDelta_Y parameters in _GUIListViewEx_EventMonitor to adjust the position. It is always better to use the furnished method to modify things rather than go fiddling around in "Internal Use Only" functions.

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

  • 5 weeks later...

OK, the array insert fix is failing when trying to color a row out of the inserted array (the first row of the rows inserted if it matters).

_GUIListViewEx_SetColour fails with:

"C:\...\AutoIt User Include\GUIListViewEx.au3" (2900) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$aCurrSplit[$i] = '0x' & StringMid($aNewSplit[$i], 7, 2) & StringMid($aNewSplit[$i], 5, 2) & StringMid($aNewSplit[$i], 3, 2)
^ ERROR

 

This is the code leading up to the error (It works fine when not inserting the array rows):

For $i = $Photos1 To $Photos5

            If $i = $sCheckbox Then ContinueLoop
            GUICtrlSetState($i, $GUI_UNCHECKED)

        Next

        _GUICtrlListView_BeginUpdate($cLV_1)

        _RetrieveProductInfo($sImageIndex)

        $ImageName = _Replace($aProductInfo[1] & "_" & $aProductInfo[3] & "_" & $aProductInfo[5] & "_" & $aProductInfo[4] & "_" & $aProductInfo[0])

        RegWrite($REGLOCATION, "BarcodeExt", "REG_SZ", GUICtrlRead($BarcodesExtI))

        _GUIListViewEx_BlockReDraw($iLVIndex_1, True)


        ;Set the URL paths
        $j = 0
        For $i = $Col_ImageM To $sImageCol

            _SetProductInfo($cLV_1, $iLVIndex_1, $sImageIndex, $i, $ImageURL & $ImageName & "_" & $j & $ImageExt)

            $j += 1

        Next

        _SetProductInfo($cLV_1, $iLVIndex_1, $sImageIndex, $Col_Status, "1")

        ;Color the product row
        For $i = 0 to UBound($aLVArray_1, 2) - 1

            _GUIListViewEx_SetColour($iLVIndex_1, ";" & $iGreen, $sImageIndex, $i)

        Next

If fails at the very start of the loop at 0 index.

 

EDIT:

It also causes a shut down when reopening a list that is saved after inserting an array:

"C:\...\AutoIt User Include\GUIListViewEx.au3" (3670) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
If StringInStr(($aGLVEx_Data[0][13])[$iItem + 1][$iSubItem], ";") Then
If StringInStr(($aGLVEx_Data[0][13]^ ERROR

 

Edited by Champak
Link to comment
Share on other sites

  • Moderators

Champak,

There are lots of "Image" variables in that code - are you adding images to the elements of the ListView?

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

Champak,

Good to hear.

But as I have said before, I need some working code if I am going to debug a UDF as complex as this one. I have no idea what is happening to the ListView and the shadow array inside it which holds the content and colour data before you start on this loop. The error shows that the latter is incorrectly dimensioned, but there is no clue as to how the UDF arrived at this state. For example, does the "_SetProductInfo" function add elements to the ListView? And does it do so using the UDF functions so the internal arrays are aligned with the new content?

I hope you can see the difficulty I face here: you provide some working code that reproduces the error and I can debug; without it, I am in the dark.

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

Found the issue. Apparently I didn't transpose the 1d array I'm inserting before inserting it. Which isn't even part of the code that I showed, because it takes place during the copypaste function smh.

What I don't understand is if I'm able to copy and insert the untransposed 1d array with no issue, and the contents show up fine in the listview and in the 2d returned listview array, why do I need to transpose the array that I'm inserting to color the rows?

Edited by Champak
Link to comment
Share on other sites

  • Moderators

Champak,

Delighted that you have found a solution, but completely in the dark as to exactly what you are doing which caused the problem as it seems to bear no relation at all with the code you posted earlier. Can you please give more details so I can understand what causes the problem - otherwise it is unlikely I can find out why you needed to "transpose" an array to make the colours work.

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

In example 6 replace the Case $cInsSpec with this:

Case $cInsSpec
            ; Insert spec row/col
            $iValue = GUICtrlRead($cSpecChoose)
            If GUICtrlRead($cRad_Row) = $GUI_CHECKED Then

                $aRet = _GUIListViewEx_ReturnArray($iLVIndex_1)

                Local $CopiedLine[UBound($aLVArray_1, 2)]

                For $i = 0 to UBound($aLVArray_1, 2) - 1

                    $CopiedLine[$i] = $aRet[$iValue][$i]

                Next

                _ArrayDisplay($CopiedLine)
            ;   _ArrayTranspose($CopiedLine)
            ;   _ArrayDisplay($CopiedLine)

                _GUIListViewEx_InsertSpec($iLVIndex_1, $iValue, $CopiedLine)

            ;   For $i = 0 to UBound($aLVArray_1, 2) - 1

            ;       _GUIListViewEx_SetColour($iLVIndex_1, ";" & "0xff0000", $iValue, $i)

            ;   Next

This works when no color is added. Uncomment the lines and it will still work. Remove the _ArrayTranspose() and it will error out with the previous error.

And yes, I also realized that I can set it up as follows:

Local $CopiedLine[1][UBound($aLVArray_1, 2)]

                For $i = 0 to UBound($aLVArray_1, 2) - 1

                    $CopiedLine[0][$i] = $aRet[$iValue][$i]

                Next

and skip the whole transpose issue, but I'm still curious as to why the coloring didn't accept the 1d array when the listview and the rest of the UDF (as far as I saw) did. Unless you meant for the coloring aspect to work like that for a whole different reason that I'm not seeing.

 

Edited by Champak
Link to comment
Share on other sites

  • Moderators

Champak,

I see the problem - and its cause. You are passing a 1D array to the _InsertSpec function while leaving the $fMultiRow parameter as "Default" (i.e. "False") by not explicitly setting it. So the UDF acts as expected and automatically sets the content of the 1D array as elements in a single row. However, when I changed the code to fix your last problem (inserting arrays of rows with colour) I did not consider this case and so the colour code only looks for a 2D array and fails when faced with a 1D array. You can see this if you amend your code to load the data as a single row 2D array:

$aRet = _GUIListViewEx_ReturnArray($iLVIndex_1)

Local $CopiedLine[1][UBound($aLVArray_1, 2)]     ; Create a 2D array

For $i = 0 to UBound($aLVArray_1, 2) - 1
    $CopiedLine[0][$i] = $aRet[$iValue][$i]      ; Fill 0 row with data
Next

Now you have a 2D array as expected by the UDF and both the data and colour code work as expected. Transposing the 1D array as you did forced the array into a 2D format which as shown above was accepted by the UDF as valid for the colour data.

I will have to write some code to check for the case of a 1D data array with no "MultiRow" parameter set and transpose it to get the colour part to work. Keep watching!

As the the "remarks with the semicolon and the hyphen". Imagine you want to remove rows 2, 4, 5, 6, 8. Semi-colons separate individual rows or groups, which are denoted by the first and last indices separated by a hyphen. So you could write this as "2;4-6;8". Clearer now?

M23

Edit: Try this for size - it works fine for me with 1D and 2D arrays: GUIListViewEx_Combined.au3

Edited by Melba23

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

Thanks for clearing up the _GUIListViewEx_DeleteSpec function.

As far as the array, I already changed the code for the array to a 2D to coincide with the actual list and moved on to other coding, but I'll give your adjustment a try the next time I'm in this situation.

Thanks.

Link to comment
Share on other sites

  • 4 weeks later...
  • Moderators

Champak,

Redeclare an array holding the new header data required and then reset the ListView using _GUIListViewEx_LoadHdrData with the new array.

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 changed the title to GUIListViewEx - BugFix Version 6 Apr 24

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