PDA

View Full Version : Deleting files from a web browser?


4090987414711
04-26-2007, 04:01 PM
Hi, Im making a file manager app, but I have added a delete button, how do I make it delete the selected file(s)?

Screenshot: http://i90.photobucket.com/albums/k250/40909874/fmanager.jpg

RizlaUK
04-26-2007, 04:57 PM
here is a function that will delete all the selected files in a listbox


-- place this function in global functions
function DeleteFilesFromListbox(LB)
sProceed = Dialog.Message( "Notice", "Are You Sure.", MB_YESNO, MB_ICONNONE, MB_DEFBUTTON1);
if sProceed == IDYES then
tSelected = ListBox.GetSelected(LB);
if tSelected then
StatusDlg.Show();
for i,v in tSelected do
strlocation = ListBox.GetItemData(LB, tSelected[1])
File.Delete(strlocation, false, false, false, nil);
ListBox.DeleteItem(LB, tSelected[1]);
error = Application.GetLastError();
end
StatusDlg.Hide();
if (error ~= 0) then
Dialog.Message( "Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
end
end
end
end

-- example of function call
DeleteFilesFromListbox( "ListBox1")

output enhanced with AMS Code Pretty (http://www.indigorose.com/forums/showthread.php?t=19409)

4090987414711
04-26-2007, 05:34 PM
Thanks RizlaUK but it aint a listbox Im usingf, im using a web object to display files and folders.
So for instance, when i click on the pic of the floppy disc, it displays the contents of the floppy in the white space below(Web1), I click on the pic of the CD & the Web updates to show the contents of that drive etc...


OK, call it a Windows Explorer alternative, but wanna delete the files, cos normally in windows, i select the file & press the delete key to delete the file, hope this has made things clearer for people hehe :)

RizlaUK
04-26-2007, 05:42 PM
ermm, ok,

i take it you are using a web object to get a thumbnail view of the files/folders,

im sure it can be done, but i haven't got the time tonight to mess about with it

if no one chimes in ill see what i can come up with tomorrow

4090987414711
04-27-2007, 07:08 AM
Thanks!
And I hope that some other people can "chime in" to provide alternate ways!

Thanks so much for your help so far! :)