Question

I have a listview with some single line entries such as...

Sub MakeListView
    ListView1.AddSingleLine("Empty1")
    ListView1.AddSingleLine("Empty2")
    ListView1.AddSingleLine("Empty3")
    ViewPNL.AddView(ListView1, 0, 0, 100%x, 100%y)
End Sub

When the user does a long click on the listview entry, they can choose to load a file using the dialogue library. I have the file load working fine into fd.ChosenName.

I'm looking for a recommendation on how to update or refresh the listview entry to reflect the file name for the file that was loaded.

So if the list were to originally read:

Empty1
Empty2
Empty3

After loading files into the positions it may read for example:

Picture 1.Jpg
My Document.Doc
Sound File.mp3

I should also add that the user may not load a file into all 3 positions at the same time. So the list would need a refresh with each individual file load into the correct position.

Was it helpful?

Solution

Try writing a sub called updateList that clears the list and then rewrites everything. It is instantaneous. Call the sub when you create the activity and then again whenever a file is selected.

Sub updateList
ListView1.Clear
If filename <> "" Then
ListView1.AddSingleLine(filename)
Else
ListView1.AddSingleLine("Empty")
End If
End Sub
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top