Jump to content
Melba23

GUIListViewEx - BugFix Version 26 Apr 19

Recommended Posts

jimmy123j,

Have you read this section of the guide which is included in the UDF download:

Quote

Closure and Reloading:

 If you delete the ListView, then it is recommended to use _GUIListViewEx_Close to free the memory used by the UDF.

 If you wish to reload the ListView with new data, you will need to clear the current content using _GUICtrlListView_DeleteAllItems, close it within the UDF using _GUIListViewEx_Close, reload the ListView with the new data and then reinitialise it using _GUIListViewEx_Init. Otherwise the UDF will become confused about the current content and errors will certainly occur.

It looks to me as if you are deleting the original data, but then NOT closing the existing instance of the ListView in the UDF before reloading it with data (and possibly reinitialising - that is not clear). In this case the UDF still believes that the ListView contains data and so will get very confused as the actual content - which is indicated by the error you get showing that the UDF internal map no longer matches the actual content.

So I recommend something along these lines:

; Clear the ListView
_GUICtrlListView_DeleteAllItems($TableList)
; Close it within the UDF
_GUIListViewEx_Close(TableIndex)
; Add new data
_GUICtrlListView_AddArray($TableList, $TableArray)
; Reinitialise the ListView with the new data
$TableIndex = _GUIListViewEx_Init($TableList, $TableArray, 0, Default, False, 32 + 512)

Does that solve the problem?

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

 

Share this post


Link to post
Share on other sites
5 hours ago, Melba23 said:

jimmy123j,

Have you read this section of the guide which is included in the UDF download:

It looks to me as if you are deleting the original data, but then NOT closing the existing instance of the ListView in the UDF before reloading it with data (and possibly reinitialising - that is not clear). In this case the UDF still believes that the ListView contains data and so will get very confused as the actual content - which is indicated by the error you get showing that the UDF internal map no longer matches the actual content.

So I recommend something along these lines:

; Clear the ListView
_GUICtrlListView_DeleteAllItems($TableList)
; Close it within the UDF
_GUIListViewEx_Close(TableIndex)
; Add new data
_GUICtrlListView_AddArray($TableList, $TableArray)
; Reinitialise the ListView with the new data
$TableIndex = _GUIListViewEx_Init($TableList, $TableArray, 0, Default, False, 32 + 512)

Does that solve the problem?

M23

Yes, I've been try to use the GUIListViewEx_Close($TableIndex) at same position, before I ask the question ( not work to me)

But I just try move over to _GUICtrlListView_DeleteAllItems($TableList), then it's work

_GUIListViewEx_Close($TableIndex)

_GUICtrlListView_DeleteAllItems($TableList)

_GUICtrlListView_AddArray($TableList, $TableArray)

$TableIndex = _GUIListViewEx_Init($TableList, $TableArray, 0, Default, False, 32 + 512)

really really thank you M23, and forgive my foolish

Thanks again !!!

Share this post


Link to post
Share on other sites

Hi M23, hope you're well.

I've added the functions from your UDF to my Calltips, and when using them, it highlighted something almost confusing: I've always ignored the second param for _GUIListViewEx_ReadToArray as I pretty much always want a count in [0]. But after comparing the results from Header Mode and Direct Mode parsing when adding Calltips, it seems that the param is named $iStart in the code for the function. If a user was to use Direct Mode when adding Calltips, then the name of the param would imply that it's "which row to start from" rather than "hold count in [0]".
A niggly, non-important thing that would be solved if a user was to take a few seconds to look at the function header; just thought I'd highlight it as you're usually nothing but consistent.

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

×
×
  • Create New...