Xojo Conferences

« Filemaker meeting in … | Home | Mountain Lion wishes?… »

Tip of the day: Move to trash

Sometimes I like to move stuff to the trash on Mac and recycle bin on Windows. And this is how you can do it using our plugins:
  Function MoveToTrash(f as FolderItem) As Boolean
#if TargetMacOS then
dim r as FolderItem
dim n as integer = MacFileOperationMBS.MoveObjectToTrashSync(f, r, _

if n = 0 then
Return true // OK
end if
#elseif TargetWin32 then
dim w as new WindowsFileCopyMBS

dim flags as integer = w.FileOperationAllowUndo + w.FileOperationNoErrorUI + _
w.FileOperationSilent + w.FileOperationNoConfirmation
if w.FileOperationDelete(f, flags) then
Return true // OK
end if

End Function
I hope you can use it. The function returns true on success and shows no error messages or confirmation dialogs.
13 06 12 - 19:20
No comments

Remember personal info?

Emoticons / Textile

Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.