rony2006

Get data from listview

6 posts in this topic

Hello,

I have a list view were I set the data using: _GUICtrlListView_AddArray($lista, $aOk)

How I can now get that data and put it in a 2d array? I cannot use $aOk because this I use multiple  _GUICtrlListView_AddArray with multiple 2d arrays like $aOk

Share this post


Link to post
Share on other sites



rony2006

The _GUIListViewEx_ReadToArray function in my GUIListViewEx UDF (look in my sig for the link) will do that for you.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

I tried _GUICtrlListView_GetItemText but seams to hard to build my array because my listview can get very big.

Now I try what Melba23 sugested

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@Melba23 Thank you! Is working perfect. 

I wanted to take the data from listview and put in a Excel. I used the following code:

Create application object
Local $oAppl = _Excel_Open()
If @error Then Exit MsgBox(16, "Excel UDF: _Excel_BookOpen Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

; *****************************************************************************
; Open an existing workbook and return its object identifier.
; *****************************************************************************
Local $sWorkbook = @ScriptDir & "\res\Excel.xlsx"
Local $oWorkbook = _Excel_BookOpen($oAppl, $sWorkbook, Default, Default, True)
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookOpen Example 1", "Error opening '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

; *****************************************************************************
; Write a part of a 2D array to the active sheet in the active workbook
; *****************************************************************************


$lt = _GUIListViewEx_ReadToArray($listatickete, 0)

 ;_ArrayDisplay($lt, "1D display")







_Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $lt, "B5")

Using you udf is possible to replace some text from listview with text + background color? or icon?

Edited by rony2006

Share this post


Link to post
Share on other sites

rony2006.

Quote

Using you udf is possible to replace some text from listview with text + background color? or icon?

The function I mentioned above is stand-alone, but if you use the full UDF and initialise your ListView it does allow you to use colour for each cell and then _GUIListViewEx_ReturnArray will return you the text or colour of the content depending on the value of the $iMode parameter. I am afraid that there is no icon functionality in the UDF - it is complicated enough already!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
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