Now Works Perfect
Thanks
hockeykid I changed the variable "listView_count" to global and used it to delete the items in the list in a seperate function.
sladeiw I appreciate the help.
Deleting the items in a reversed order solved the problem.
Here is a pieces of the code from the example that came with the plug in . I modified it a little ....
sync off
set display mode 800,600,32
sync rate 60
color backdrop 0
startBlue "UserID","Password"
global Texture_Window
global TextureLibrary AS INTEGER
global listView AS INTEGER
global listView_count
global Folder_button
Make_Texture_frame()
do
getEvent
if eventSource()=Folder_button and eventType()=MOUSE_CLICK
Clear_listView()
load_listView()
endif
if eventType()=WINDOW_CLOSE
if eventSource()=Texture_Window
end
endif
endif
if len (getListViewItemText(listView,selectedListViewItem(listView),0))>0
if image exist(100)=1 then delete image 100
load image getListViewItemText(listView,selectedListViewItem(listView),0),100
endif
cls
if image exist(100)=1
paste image 100,0,0
imagefilename$=getListViewItemText(listView,selectedListViewItem(listView),0)
text 0,image height(100)+20,imagefilename$
endif
sync
loop
FUNCTION Make_Texture_frame()
Texture_Window=createWindow(535, 335, 265, 265, "Texture Library", WINDOW_NORMAL, WINDOW_TOOLWINDOW, 1, 0)
TextureLibrary=createFrame(5, 5, 240, 220, "Texture Library", Texture_Window)
listView=createlistView(10, 15, 220, 170, TextureLibrary)
Folder_button=createButton(175, 190, 40, 15, "Folder", 1, TextureLibrary)
paintGadget listView
ENDFUNCTION
FUNCTION load_listView()
selFolder$=folderDialog()
if len(selFolder$) > 0
set dir selFolder$
perform checklist for files
listView_count=checklist quantity()
local ext as string
for i=1 to listView_count
if file exist(checklist string$(i))
ext=lower$(right$(checklist string$(i),4))
if (ext <> ".bmp") and (ext <> ".jpg") and (ext <> "jpeg") and (ext <> ".tga") and (ext <> ".dds") and (ext <> ".dib") and (ext <> ".png")
else
addListViewItem listView,checklist string$(i),loadedCount
inc loadedCount
endif
endif
next i
EMPTY CHECKLIST
endif
ENDFUNCTION
`Clearing the viewlist
FUNCTION Clear_listView()
setAutoUpdate listView,0
for i=listView_count-1 to 0 step -1
removelistviewitem listView,i
next i
setAutoUpdate listView,1
ENDFUNCTION