Jump to content

GUIListViewEx - BugFix Version 6 Apr 24


Melba23
 Share

Recommended Posts

@Melba23Thank you for the reply. I’m just starting to learn your UDF and spent most of yesterday puzzled why the header coloring didn’t work as expected, even in the Example codes.

Tried numerous combinations without success, read and re-read the function definitions, rtf guide, and examples. So reached out to you to see if I had some basic misunderstanding of that function.

After I had commented, I found the recent posts where this issue was gradually uncovered by @borsTiHD and yourself. Wary of what other functionality is quietly not working as expected.

Running the code compiled in x86 mode is possible for now but writing code, debugging and testing in the interpreter is a hiccup.

Edited by CodeWriter
Link to comment
Share on other sites

  • Moderators

CodeWriter,

Quote

Wary of what other functionality is quietly not working as expected

Nothing as far as I know!

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

Here’s another quirk  with some sample code, adapted straight from your examples. The code snipet below creates a listview with 4 columns and populates them from an array[n][4]. Except for a different array name and GUI sizes, the exact same code runs without error using a listview with 2 columns and array[n][2].

; Create GUI:
    Local $hMacroGUI, $vData, $hMacro, $iEditMode = 0, $bEdited = False
    $hMacroGUI = GUICreate("Active Macros", 1520, 945, 25, 990)

    ; Create ListView using GUICtrlListViewEx.au3 UDF:
    $hMacro = _GUICtrlListView_Create($hMacroGUI, "", 5, 5, 1510, 890, BitOR($LVS_DEFAULT, $WS_BORDER))
    _GUICtrlListView_SetExtendedListViewStyle($hMacro, $LVS_EX_FULLROWSELECT)
    _GUICtrlListView_AddColumn($hMacro, "Column1", 200)
    _GUICtrlListView_AddColumn($hMacro, "Column2", 250)
    _GUICtrlListView_AddColumn($hMacro, "Column3", 400)
    _GUICtrlListView_AddColumn($hMacro, "Column4", 3000)

    ; Set font:
    Local $hFont = _WinAPI_CreateFont(19, 7, 0, 0, $FW_NORMAL, False, False, False, $DEFAULT_CHARSET, _
            $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, "Helvetica")
    _WinAPI_SetFont($hMacro, $hFont, True)

    ; Populate the ListView:
    Local $limit = UBound($Gmacro) - 1
    For $i = 0 To $limit
        _GUICtrlListView_AddItem($hMacro, $Gmacro[$i][0])
        _GUICtrlListView_AddSubItem($hMacro, $i, $Gmacro[$i][1], 1)
        _GUICtrlListView_AddSubItem($hMacro, $i, $Gmacro[$i][2], 2)
        _GUICtrlListView_AddSubItem($hMacro, $i, $Gmacro[$i][3], 3)
    Next

    ; Initialize the GUIListViewEx UDF: (16: enable color header, 32: user colored items)
    Local $iLV = _GUIListViewEx_Init($hMacro, $Gmacro, 0, 0xFF0000, True, 16 + 32)

when execution reaches the last line

Local $iLV = _GUIListViewEx_Init($hMacro, $Gmacro, 0, 0xFF0000, True, 16 + 32)

it results in the following error:

"C:\Users\...\GUIListViewEx.au3" (517) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$aLVArray[$i + $iStart][$j - 1] = $aRow[$j]
^ ERROR

I have also tried  reading the array into the UDF before initialization with the following line but it fails with the same error  from _GUIListViewEx_ReadToArray():

$aLV_List = _GUIListViewEx_ReadToArray($hMacro, 0)

Stranger still, if you simply comment out column 4 and the corresponding line populating the listview in the For loop, it works without error for a 3-column display. I don't know if this is related in some way to the same 64-bit issue but it also fails when I compile the code in x86 mode.

A separate issue is that string data in my array[n][4] can be 2000 chars long but only about 265 chars are displayed before being truncated in the listview.

Edited by CodeWriter
Link to comment
Share on other sites

  • Moderators

CodeWriter,

I have added a few lines to your snippet so it runs (please post runnable code in future) and it loads a 4x4 array with no problems:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPIGdi.au3>
#include <FontConstants.au3>

#include "GUIListViewEx.au3"

Global $Gmacro[4][4] =[[1,2,3,4],[5,6,7,8],["a","b","c","d"],["w","x","y","z"]]

; Create GUI:
    Local $hMacroGUI, $vData, $hMacro, $iEditMode = 0, $bEdited = False
    $hMacroGUI = GUICreate("Active Macros", 1520, 945, 25, 25)

    ; Create ListView using GUICtrlListViewEx.au3 UDF:
    $hMacro = _GUICtrlListView_Create($hMacroGUI, "", 5, 5, 1510, 890, BitOR($LVS_DEFAULT, $WS_BORDER))
    _GUICtrlListView_SetExtendedListViewStyle($hMacro, $LVS_EX_FULLROWSELECT)
    _GUICtrlListView_AddColumn($hMacro, "Column1", 200)
    _GUICtrlListView_AddColumn($hMacro, "Column2", 250)
    _GUICtrlListView_AddColumn($hMacro, "Column3", 400)
    _GUICtrlListView_AddColumn($hMacro, "Column4", 3000)

    ; Set font:
    Local $hFont = _WinAPI_CreateFont(19, 7, 0, 0, $FW_NORMAL, False, False, False, $DEFAULT_CHARSET, _
           $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, "Helvetica")
    _WinAPI_SetFont($hMacro, $hFont, True)

    ; Populate the ListView:
    Local $limit = UBound($Gmacro) - 1
    For $i = 0 To $limit
        _GUICtrlListView_AddItem($hMacro, $Gmacro[$i][0])
        _GUICtrlListView_AddSubItem($hMacro, $i, $Gmacro[$i][1], 1)
        _GUICtrlListView_AddSubItem($hMacro, $i, $Gmacro[$i][2], 2)
        _GUICtrlListView_AddSubItem($hMacro, $i, $Gmacro[$i][3], 3)
    Next

    ; Initialize the GUIListViewEx UDF: (16: enable color header, 32: user colored items)
    Local $iLV = _GUIListViewEx_Init($hMacro, $Gmacro, 0, 0xFF0000, True, 16 + 32)

    GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

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

@Melba23Your example helped me to find the core issue which is the data in my array. The 4th column is populated by a 2000-3000 character string that contains UTF-8 characters. When I replace that with ASCII characters in a test, there is no error from _GUIListViewEx_Init() or_GUIListViewEx_ReadToArray(). Without the ability to use UTF-8 and the standard ListView limiting the data cells to about 265 chars, I will work on another approach. Thank you for your help.

Link to comment
Share on other sites

  • Moderators

CodeWriter,

Sorry to hear that - but glad it was not my UDF at fault!

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

While the standard ListView and GUIListView.au3 functions can handle UTF-8 characters, something in your UDF functions _GUIListViewEx_Init() and_GUIListViewEx_ReadToArray() is unable to process those characters and throws an error.

Edited by CodeWriter
Link to comment
Share on other sites

  • Moderators

CodeWriter,

Can you let me have a copy of some of the data you are trying to insert so that I can have a play and see if I can come up with a solution - via PM if you do not want to post in open forum.

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

All,

The problem was that the data contained the default Data Separation Character ("|") which the UDF (and AutoIt) was interpreting as a column delimiter. The solution was to change the default separator character using Opt.

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