Jump to content

A way to select a list of items from an Array


mLipok
 Share

Recommended Posts

Usually when I collect data from DataBase I need to give EndUser a possibility to select rows which should be taken in the processing loop.
I was searching on the forum and I'm not able to find any UDF or even example of how to select data from array.
I have my own solutions but I think they are not worth posting on the forum as it is very old code and I am looking for a better solution.

Could anybody point me to some examples/solutions ?

Thank you in advance.
@mLipok

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Thanks. Interesting.

I would prefer something like ArrayDisplay which will give you all selected ID's


 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Well, I forgot about this magical corner.
There are many examples of displaying data from a database. I have to prepare something ...

I think I will refactor my current function and show it here. Then the conversation will be more precise.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

As I said this is my old code.... so....
Here is my "some way refactored" code:

#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>

_Example()
Func _Example()
    Local $a_Test[100][10]
    For $ROW = 0 To 99
        For $COL = 0 To 9
            $a_Test[$ROW][$COL] = 'Test #' & $COL
        Next
    Next

    Local $a_Selected = _Array_Select($a_Test, 'Testing', 'Choose few rows', False)
    _ArrayDisplay($a_Selected, '$a_Selected')
EndFunc   ;==>_Example


Func _Array_Select(ByRef $a_Source, $s_title, $s_Information, $b_ArrayHasHeader = True, $hWnd_Parent = 0)
    If Not IsArray($a_Source) Then Return SetError(1, 0, "is not array")

    Local $i_Source_Rows_Count = UBound($a_Source, $UBOUND_ROWS), $i_Source_Cols_Count = UBound($a_Source, $UBOUND_COLUMNS)
    Local $i_Temp_Cols_Count
    If $i_Source_Cols_Count < 0 Then $i_Source_Cols_Count = 0
    If $i_Source_Cols_Count = 0 Then ; If 1D Array
        $i_Temp_Cols_Count = $i_Source_Cols_Count + 1
    Else
        $i_Temp_Cols_Count = $i_Source_Cols_Count
    EndIf

    Local $a_Temp_2[$i_Source_Rows_Count][$i_Temp_Cols_Count]
    If $b_ArrayHasHeader Then
        For $icols = 0 To $i_Temp_Cols_Count - 1
            For $irows = 0 To $i_Source_Rows_Count - 1
                If $i_Source_Cols_Count > 0 Then
                    $a_Temp_2[$irows][$icols] = $a_Source[$irows][$icols]
                Else
                    $a_Temp_2[$irows][$icols] = $a_Source[$irows]
                EndIf
            Next
        Next
    EndIf

    Local $hGuiForm_1 = GUICreate($s_title, 900, 680, 100, -1, -1, -1, $hWnd_Parent)
    GUISetFont(8.5)
    GUICtrlCreateLabel($s_Information, 8, 8, 900, 50)
    Local $id_ListView_1 = GUICtrlCreateListView("", 0, 52, 900, 600, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
    Local $h_ListView_Wybierz = ControlGetHandle($hGuiForm_1, "", $id_ListView_1)

    Local $id_Button_Select = GUICtrlCreateButton("&Wybierz zaznaczone", 0, 655, 900 - 200, 25, 0)
    GUICtrlSetBkColor($id_Button_Select, 0xA6CAF0)
    GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE)
    Local $id_Button_Cancel = GUICtrlCreateButton("&Anuluj", 900 - 200, 655, 200, 25, 0)
    GUICtrlSetBkColor($id_Button_Cancel, 0xFFFFE1)
    GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE)
    GUISetState(@SW_SHOW)

    #Region - FillUp ListView
    _GUICtrlListView_BeginUpdate($h_ListView_Wybierz)
    Local $a_Processing
    If $b_ArrayHasHeader Then
        $a_Processing = $a_Temp_2
        If $i_Source_Cols_Count > 0 Then
            For $a = 0 To $i_Temp_Cols_Count - 1
                _GUICtrlListView_AddColumn($h_ListView_Wybierz, $a_Processing[0][$a])
            Next
        Else
            _GUICtrlListView_AddColumn($h_ListView_Wybierz, $a_Processing[0][0])
        EndIf
    Else
        $a_Processing = $a_Source
        If $i_Source_Cols_Count > 0 Then
            For $a = 0 To $i_Temp_Cols_Count - 1
                _GUICtrlListView_AddColumn($h_ListView_Wybierz, '')
            Next
        Else
            _GUICtrlListView_AddColumn($h_ListView_Wybierz, '')
        EndIf
    EndIf

    For $id_X_Row = 0 To $i_Source_Rows_Count - 1
        _GUICtrlListView_AddItem($h_ListView_Wybierz, $a_Processing[$id_X_Row][0])
        For $id_X_Col = 0 To $i_Temp_Cols_Count - 1
            _GUICtrlListView_AddSubItem($h_ListView_Wybierz, $id_X_Row, $a_Processing[$id_X_Row][$id_X_Col], $id_X_Col)
        Next
    Next
    _GUICtrlListView_ClickItem($h_ListView_Wybierz, 1, "left", True, 2)
    Send("{CTRLDOWN}{SHIFTDOWN}")
    ControlSend($hGuiForm_1, "", $id_ListView_1, "{NUMPADADD}")
    Send("{SHIFTUP}{CTRLUP}")
    If $b_ArrayHasHeader Then _GUICtrlListView_DeleteItem($h_ListView_Wybierz, 0)
    _GUICtrlListView_EndUpdate($h_ListView_Wybierz)
    #EndRegion - FillUp ListView

    Local $nMsg
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $id_Button_Select
                If _GUICtrlListView_GetSelectionMark($h_ListView_Wybierz) = -1 Then
                    GUIDelete($hGuiForm_1)
                    Return SetError(1, 0, "Nie dokonano wyboru")
                EndIf
                Local $a_Result = StringSplit(_GUICtrlListView_GetSelectedIndices($h_ListView_Wybierz), "|") ; Returns pipe "|" delimited string, "|")
                GUIDelete($hGuiForm_1)
                If $b_ArrayHasHeader Then
                    For $IDX_Choosen = 1 To $a_Result[0] ; zwiększam wartosc o jeden bo wyniki z listview sa mniejsze o jeden w stosunku tablicy poczatkowej
                        $a_Result[$IDX_Choosen] += 1
                    Next
                EndIf
                Return $a_Result
            Case $id_Button_Cancel, $GUI_EVENT_CLOSE
                GUIDelete($hGuiForm_1)
                Return SetError(1, 0, "Nie dokonano wyboru")
        EndSwitch
    WEnd
EndFunc   ;==>_Array_Select

Any ideas for improvement would be appreciated.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

@mLipok I slightly improved the UI by adding check marks for selection:

#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>

_Example()
Func _Example()
    Local $a_Test[100][10]
    For $ROW = 0 To 99
        For $COL = 0 To 9
            $a_Test[$ROW][$COL] = 'Test #' & $COL
        Next
    Next

    Local $a_Selected = _Array_Select($a_Test, 'Testing', 'Choose few rows', False)
    _ArrayDisplay($a_Selected, '$a_Selected')
EndFunc   ;==>_Example


Func _Array_Select(ByRef $a_Source, $s_title, $s_Information, $b_ArrayHasHeader = True, $hWnd_Parent = 0)
    If Not IsArray($a_Source) Then Return SetError(1, 0, "is not array")

    Local $i_Source_Rows_Count = UBound($a_Source, $UBOUND_ROWS), $i_Source_Cols_Count = UBound($a_Source, $UBOUND_COLUMNS)
    Local $i_Temp_Cols_Count
    If $i_Source_Cols_Count < 0 Then $i_Source_Cols_Count = 0
    If $i_Source_Cols_Count = 0 Then ; If 1D Array
        $i_Temp_Cols_Count = $i_Source_Cols_Count + 1
    Else
        $i_Temp_Cols_Count = $i_Source_Cols_Count
    EndIf

    Local $a_Temp_2[$i_Source_Rows_Count][$i_Temp_Cols_Count]
    If $b_ArrayHasHeader Then
        For $icols = 0 To $i_Temp_Cols_Count - 1
            For $irows = 0 To $i_Source_Rows_Count - 1
                If $i_Source_Cols_Count > 0 Then
                    $a_Temp_2[$irows][$icols] = $a_Source[$irows][$icols]
                Else
                    $a_Temp_2[$irows][$icols] = $a_Source[$irows]
                EndIf
            Next
        Next
    EndIf

    Local $hGuiForm_1 = GUICreate($s_title, 900, 680, 100, -1, -1, -1, $hWnd_Parent)
    GUISetFont(8.5)
    GUICtrlCreateLabel($s_Information, 8, 8, 900, 50)
    Local $id_ListView_1 = GUICtrlCreateListView("", 0, 52, 900, 600, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
    Local $h_ListView_Wybierz = ControlGetHandle($hGuiForm_1, "", $id_ListView_1)

    Local $id_Button_Select = GUICtrlCreateButton("&Wybierz zaznaczone", 0, 655, 900 - 200, 25, 0)
    GUICtrlSetBkColor($id_Button_Select, 0xA6CAF0)
    GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE)
    Local $id_Button_Cancel = GUICtrlCreateButton("&Anuluj", 900 - 200, 655, 200, 25, 0)
    GUICtrlSetBkColor($id_Button_Cancel, 0xFFFFE1)
    GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE)
    GUISetState(@SW_SHOW)

    #Region - FillUp ListView
    _GUICtrlListView_BeginUpdate($h_ListView_Wybierz)
    Local $a_Processing
    If $b_ArrayHasHeader Then
        $a_Processing = $a_Temp_2
        If $i_Source_Cols_Count > 0 Then
            For $a = 0 To $i_Temp_Cols_Count - 1
                _GUICtrlListView_AddColumn($h_ListView_Wybierz, $a_Processing[0][$a])
            Next
        Else
            _GUICtrlListView_AddColumn($h_ListView_Wybierz, $a_Processing[0][0])
        EndIf
    Else
        $a_Processing = $a_Source
        If $i_Source_Cols_Count > 0 Then
            For $a = 0 To $i_Temp_Cols_Count - 1
                _GUICtrlListView_AddColumn($h_ListView_Wybierz, '')
            Next
        Else
            _GUICtrlListView_AddColumn($h_ListView_Wybierz, '')
        EndIf
    EndIf

    For $id_X_Row = 0 To $i_Source_Rows_Count - 1
        _GUICtrlListView_AddItem($h_ListView_Wybierz, $a_Processing[$id_X_Row][0])
        For $id_X_Col = 0 To $i_Temp_Cols_Count - 1
            _GUICtrlListView_AddSubItem($h_ListView_Wybierz, $id_X_Row, $a_Processing[$id_X_Row][$id_X_Col], $id_X_Col)
        Next
    Next
    _GUICtrlListView_ClickItem($h_ListView_Wybierz, 1, "left", True, 2)
    Send("{CTRLDOWN}{SHIFTDOWN}")
    ControlSend($hGuiForm_1, "", $id_ListView_1, "{NUMPADADD}")
    Send("{SHIFTUP}{CTRLUP}")
    If $b_ArrayHasHeader Then _GUICtrlListView_DeleteItem($h_ListView_Wybierz, 0)
    _GUICtrlListView_EndUpdate($h_ListView_Wybierz)
    #EndRegion - FillUp ListView

    Local $nMsg
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $id_Button_Select
                Local $a_Result = StringSplit(_GUICtrlListView_GetCheckedIndices($h_ListView_Wybierz), "|") ; Returns pipe "|" delimited string, "|")
                GUIDelete($hGuiForm_1)
                If $a_Result[0] = 0 Then Return SetError(1, 0, "Nie dokonano wyboru")
                If $b_ArrayHasHeader Then
                    For $IDX_Choosen = 1 To $a_Result[0] ; zwiększam wartosc o jeden bo wyniki z listview sa mniejsze o jeden w stosunku tablicy poczatkowej
                        $a_Result[$IDX_Choosen] += 1
                    Next
                EndIf
                Return $a_Result
            Case $id_Button_Cancel, $GUI_EVENT_CLOSE
                GUIDelete($hGuiForm_1)
                Return SetError(1, 0, "Nie dokonano wyboru")
        EndSwitch
    WEnd
EndFunc   ;==>_Array_Select

; #FUNCTION# ====================================================================================================================
; Author ........: Gary Frost (gafrost)
; Modified.......: Damon Harris (TheDcoder) (forked from GetSelectedIndices)
; ===============================================================================================================================
Func _GUICtrlListView_GetCheckedIndices($hWnd, $bArray = False)
    Local $tLVITEM = DllStructCreate($tagLVITEM)
    DllStructSetData($tLVITEM, "Mask", $LVIF_STATE)
    DllStructSetData($tLVITEM, "StateMask", 0xffff)

    Local $sIndices, $aIndices[1] = [0]
    Local $iRet, $iCount = _GUICtrlListView_GetItemCount($hWnd)
    For $iItem = 0 To $iCount
        DllStructSetData($tLVITEM, "Item", $iItem)
        If IsHWnd($hWnd) Then
            $iRet = _SendMessage($hWnd, $LVM_GETITEMW, 0, $tLVITEM, 0, "wparam", "struct*") <> 0
        Else
            $iRet = GUICtrlSendMsg($hWnd, $LVM_GETITEMSTATE, 0, $tLVITEM)
        EndIf
        Local $bChecked = BitAND(DllStructGetData($tLVITEM, "State"), 0x2000) <> 0
        If $bChecked Then
            If (Not $bArray) Then
                If StringLen($sIndices) Then
                    $sIndices &= "|" & $iItem
                Else
                    $sIndices = $iItem
                EndIf
            Else
                ReDim $aIndices[UBound($aIndices) + 1]
                $aIndices[0] = UBound($aIndices) - 1
                $aIndices[UBound($aIndices) - 1] = $iItem
            EndIf
        EndIf
    Next
    If (Not $bArray) Then
        Return String($sIndices)
    Else
        Return $aIndices
    EndIf
EndFunc   ;==>_GUICtrlListView_GetCheckedIndices

I added a new function called _GUICtrlListView_GetCheckedIndices which returns the indexes which are checked from a list view. Credit goes to Gary Frost as I just mashed up two of his functions (_GUICtrlListView_GetSelectedIndices and _GUICtrlListView_GetItemChecked) to create the function:thumbsup:

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

Nice.
But I still prefer to selecting rows instead checking items in the listview.

Here is my improved example:
 

;~ https://www.autoitscript.com/forum/topic/207118-a-way-to-select-a-list-of-items-from-an-array/?tab=comments#comment-1493276

#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>

_Example(2000, 40)

Func _Example($iRows, $iCols)
    Local $a_Test[$iRows][$iCols]
    For $ROW = 0 To $iRows - 1
        For $COL = 0 To $iCols - 1
            $a_Test[$ROW][$COL] = 'Test long text here #' & $COL
        Next
    Next

    Local $a_Selected = _Array_Select($a_Test, 'Testing', 'Choose few rows', True)
;~  Local $a_Selected = _Array_Select($a_Test, 'Testing', 'Choose few rows', False)
    _ArrayDisplay($a_Selected, '$a_Selected')
EndFunc   ;==>_Example


Func _Array_Select(ByRef $a_Source, $s_title, $s_Information, $b_ArrayHasHeader = True, $hWnd_Parent = 0)
    Local $hTimer = TimerInit()
    If Not IsArray($a_Source) Then Return SetError(1, 0, "is not array")

    Local $i_Source_Rows_Count = UBound($a_Source, $UBOUND_ROWS), $i_Source_Cols_Count = UBound($a_Source, $UBOUND_COLUMNS)
    Local $i_Temp_Cols_Count
    If $i_Source_Cols_Count < 0 Then $i_Source_Cols_Count = 0
    If $i_Source_Cols_Count = 0 Then ; If 1D Array
        $i_Temp_Cols_Count = $i_Source_Cols_Count + 1
    Else
        $i_Temp_Cols_Count = $i_Source_Cols_Count
    EndIf

    Local $a_Temp_2[$i_Source_Rows_Count][$i_Temp_Cols_Count]
    If $b_ArrayHasHeader Then
        For $icols = 0 To $i_Temp_Cols_Count - 1
            For $irows = 0 To $i_Source_Rows_Count - 1
                If $i_Source_Cols_Count > 0 Then
                    $a_Temp_2[$irows][$icols] = $a_Source[$irows][$icols]
                Else
                    $a_Temp_2[$irows][$icols] = $a_Source[$irows]
                EndIf
            Next
        Next
    EndIf

    Local $hGuiForm_1 = GUICreate($s_title, 900, 680, 100, -1, -1, -1, $hWnd_Parent)
    GUISetFont(8.5)
    GUICtrlCreateLabel($s_Information, 8, 8, 900, 50)
    Local $id_ListView_1 = GUICtrlCreateListView("", 0, 52, 900, 600, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
    Local $h_ListView_Wybierz = ControlGetHandle($hGuiForm_1, "", $id_ListView_1)

    Local $id_Button_Select = GUICtrlCreateButton("&Wybierz zaznaczone", 0, 655, 900 - 200, 25, 0)
    GUICtrlSetBkColor($id_Button_Select, 0xA6CAF0)
    GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE)
    Local $id_Button_Cancel = GUICtrlCreateButton("&Anuluj", 900 - 200, 655, 200, 25, 0)
    GUICtrlSetBkColor($id_Button_Cancel, 0xFFFFE1)
    GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE)
    GUISetState(@SW_SHOW)

    #Region - FillUp ListView
    _GUICtrlListView_BeginUpdate($h_ListView_Wybierz)
    Local $a_Processing
    If $b_ArrayHasHeader Then
        $a_Processing = $a_Temp_2
        If $i_Source_Cols_Count > 0 Then
            For $a = 0 To $i_Temp_Cols_Count - 1
                _GUICtrlListView_AddColumn($h_ListView_Wybierz, $a_Processing[0][$a])
            Next
        Else
            _GUICtrlListView_AddColumn($h_ListView_Wybierz, $a_Processing[0][0])
        EndIf
    Else
        $a_Processing = $a_Source
        If $i_Source_Cols_Count > 0 Then
            For $a = 0 To $i_Temp_Cols_Count - 1
                _GUICtrlListView_AddColumn($h_ListView_Wybierz, '')
            Next
        Else
            _GUICtrlListView_AddColumn($h_ListView_Wybierz, '')
        EndIf
    EndIf

    For $id_X_Row = 0 To $i_Source_Rows_Count - 1
        _GUICtrlListView_AddItem($h_ListView_Wybierz, $a_Processing[$id_X_Row][0])
        For $id_X_Col = 0 To $i_Temp_Cols_Count - 1
            _GUICtrlListView_AddSubItem($h_ListView_Wybierz, $id_X_Row, $a_Processing[$id_X_Row][$id_X_Col], $id_X_Col)
        Next
    Next
    _GUICtrlListView_ClickItem($h_ListView_Wybierz, 1, "left", True, 2)
    Send("{CTRLDOWN}{SHIFTDOWN}")
    ControlSend($hGuiForm_1, "", $id_ListView_1, "{NUMPADADD}")
    Send("{SHIFTUP}{CTRLUP}")
    If $b_ArrayHasHeader Then _GUICtrlListView_DeleteItem($h_ListView_Wybierz, 0)
    _GUICtrlListView_EndUpdate($h_ListView_Wybierz)
    #EndRegion - FillUp ListView
    Local $iSeconds = TimerDiff($hTimer) / 1000
    ConsoleWrite("! $iSeconds = " & $iSeconds & @CRLF)

    Local $nMsg
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $id_Button_Select
                If _GUICtrlListView_GetSelectionMark($h_ListView_Wybierz) = -1 Then
                    GUIDelete($hGuiForm_1)
                    Return SetError(1, 0, "Nie dokonano wyboru")
                EndIf
                Local $a_Result = StringSplit(_GUICtrlListView_GetSelectedIndices($h_ListView_Wybierz), "|") ; Returns pipe "|" delimited string, "|")
                GUIDelete($hGuiForm_1)
                If $b_ArrayHasHeader Then
                    For $IDX_Choosen = 1 To $a_Result[0] ; zwiększam wartosc o jeden bo wyniki z listview sa mniejsze o jeden w stosunku tablicy poczatkowej
                        $a_Result[$IDX_Choosen] += 1
                    Next
                EndIf
                Return $a_Result
            Case $id_Button_Cancel, $GUI_EVENT_CLOSE
                GUIDelete($hGuiForm_1)
                Return SetError(1, 0, "Nie dokonano wyboru")
        EndSwitch
    WEnd
EndFunc   ;==>_Array_Select

On my PC it takes about 11 second to display all the data.
My goal is to use normal ListView and not VirtualListview, but I must speed up this somehow.

I think that I must to use this following tip:

  

On 3/22/2015 at 2:17 PM, LarsJ said:

If not more than 10,000 rows have to be inserted in a listview, a standard listview is sufficiently rapid. Because of speed you should use native (built-in) functions to fill the listview and not functions in GuiListView.au3 UDF. When the listview is filled, you can use all the functions in the UDF.

 

and adopt some trick from @LarsJ LvStandard.au3

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • 2 weeks later...

As for now I have this:

#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>

_Example(2000, 40)

Func _Example($iRows, $iCols)
    Local $a_Test[$iRows][$iCols]
    For $ROW = 0 To $iRows - 1
        For $COL = 0 To $iCols - 1
            $a_Test[$ROW][$COL] = 'Test long text here #' & $ROW & "," &  $COL
        Next
    Next

;~  Local $a_Selected = _Array_Select($a_Test, 'Testing', 'Choose few rows', True)
    Local $a_Selected = _Array_Select($a_Test, 'Testing', 'Choose few rows', False)
    _ArrayDisplay($a_Selected, '$a_Selected')
EndFunc   ;==>_Example


Func _Array_Select(ByRef $a_Source, $s_title, $s_Information, $b_ArrayHasHeader = True, $hWnd_Parent = 0)
    Local $hTimer = TimerInit()
    If Not IsArray($a_Source) Then Return SetError(1, 0, "is not array")

    Local $i_Source_Rows_Count = UBound($a_Source, $UBOUND_ROWS), $i_Source_Cols_Count = UBound($a_Source, $UBOUND_COLUMNS)
    Local $i_Temp_Cols_Count
    If $i_Source_Cols_Count < 0 Then $i_Source_Cols_Count = 0
    If $i_Source_Cols_Count = 0 Then ; If 1D Array
        $i_Temp_Cols_Count = $i_Source_Cols_Count + 1
    Else
        $i_Temp_Cols_Count = $i_Source_Cols_Count
    EndIf

    Local $a_Temp_2[$i_Source_Rows_Count][$i_Temp_Cols_Count]
    If $b_ArrayHasHeader Then
        For $iCols = 0 To $i_Temp_Cols_Count - 1
            For $iRows = 0 To $i_Source_Rows_Count - 1
                If $i_Source_Cols_Count > 0 Then
                    $a_Temp_2[$iRows][$iCols] = $a_Source[$iRows][$iCols]
                Else
                    $a_Temp_2[$iRows][$iCols] = $a_Source[$iRows]
                EndIf
            Next
        Next
    EndIf

    Local $hGuiForm_1 = GUICreate($s_title, 900, 680, 100, -1, -1, -1, $hWnd_Parent)
    GUISetFont(8.5)
    GUICtrlCreateLabel($s_Information, 8, 8, 900, 50)
    Local $id_ListView_1 = GUICtrlCreateListView("", 0, 52, 900, 600, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
    Local $h_ListView_Wybierz = ControlGetHandle($hGuiForm_1, "", $id_ListView_1)

    Local $id_Button_Select = GUICtrlCreateButton("&Wybierz zaznaczone", 0, 655, 900 - 200, 25, 0)
    GUICtrlSetBkColor($id_Button_Select, 0xA6CAF0)
    GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE)
    Local $id_Button_Cancel = GUICtrlCreateButton("&Anuluj", 900 - 200, 655, 200, 25, 0)
    GUICtrlSetBkColor($id_Button_Cancel, 0xFFFFE1)
    GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE)
;~  GUISetState(@SW_SHOW)

    #Region - FillUp ListView
    _GUICtrlListView_BeginUpdate($h_ListView_Wybierz)
    Local $a_Processing
    If $b_ArrayHasHeader Then
        $a_Processing = $a_Temp_2
        If $i_Source_Cols_Count > 0 Then
            For $a = 0 To $i_Temp_Cols_Count - 1
                _GUICtrlListView_AddColumn($h_ListView_Wybierz, $a_Processing[0][$a])
            Next
        Else
            _GUICtrlListView_AddColumn($h_ListView_Wybierz, $a_Processing[0][0])
        EndIf
    Else
        $a_Processing = $a_Source
        If $i_Source_Cols_Count > 0 Then
            For $a = 0 To $i_Temp_Cols_Count - 1
                _GUICtrlListView_AddColumn($h_ListView_Wybierz, '')
            Next
        Else
            _GUICtrlListView_AddColumn($h_ListView_Wybierz, '')
        EndIf
    EndIf

;~  For $id_X_Row = 0 To $i_Source_Rows_Count - 1
;~      _GUICtrlListView_AddItem($h_ListView_Wybierz, $a_Processing[$id_X_Row][0])
;~      For $id_X_Col = 0 To $i_Temp_Cols_Count - 1
;~          _GUICtrlListView_AddSubItem($h_ListView_Wybierz, $id_X_Row, $a_Processing[$id_X_Row][$id_X_Col], $id_X_Col)
;~      Next
;~  Next
    FillListView($id_ListView_1, $a_Source, UBound($a_Source, 1))

    _GUICtrlListView_ClickItem($h_ListView_Wybierz, 1, "left", True, 2)
    Send("{CTRLDOWN}{SHIFTDOWN}")
    ControlSend($hGuiForm_1, "", $id_ListView_1, "{NUMPADADD}")
    Send("{SHIFTUP}{CTRLUP}")
    If $b_ArrayHasHeader Then _GUICtrlListView_DeleteItem($h_ListView_Wybierz, 0)
    _GUICtrlListView_EndUpdate($h_ListView_Wybierz)
    #EndRegion - FillUp ListView
    GUISetState(@SW_SHOW)
    Local $iSeconds = TimerDiff($hTimer) / 1000
    ConsoleWrite("! $iSeconds = " & $iSeconds & @CRLF)

    Local $nMsg
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $id_Button_Select
                If _GUICtrlListView_GetSelectionMark($h_ListView_Wybierz) = -1 Then
                    GUIDelete($hGuiForm_1)
                    Return SetError(1, 0, "Nie dokonano wyboru")
                EndIf
                Local $a_Result = StringSplit(_GUICtrlListView_GetSelectedIndices($h_ListView_Wybierz), "|") ; Returns pipe "|" delimited string, "|")
                GUIDelete($hGuiForm_1)
                If $b_ArrayHasHeader Then
                    For $IDX_Choosen = 1 To $a_Result[0] ; zwiększam wartosc o jeden bo wyniki z listview sa mniejsze o jeden w stosunku tablicy poczatkowej
                        $a_Result[$IDX_Choosen] += 1
                    Next
                EndIf
                Return $a_Result
            Case $id_Button_Cancel, $GUI_EVENT_CLOSE
                GUIDelete($hGuiForm_1)
                Return SetError(1, 0, "Nie dokonano wyboru")
        EndSwitch
    WEnd
EndFunc   ;==>_Array_Select

Func FillListView($idLV, ByRef $aItems, $iRows)
    Local $tLVITEM = DllStructCreate($tagLVITEM)
    Local $pLVITEM = DllStructGetPtr($tLVITEM), $k, $s
    DllStructSetData($tLVITEM, "Mask", $LVIF_IMAGE)   ; Icon (or image)
    DllStructSetData($tLVITEM, "SubItem", 0)          ; First column
    For $j = 0 To $iRows - 1
        ; Text
        $s = $aItems[$k + $j][0]
        For $l = 1 To UBound($aItems, 2) - 1
            $s &= "|" & $aItems[$k + $j][$l]
        Next
        GUICtrlCreateListViewItem($s, $idLV)              ; Add item and all texts
    Next
EndFunc   ;==>FillListView

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

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

×
×
  • Create New...