[futurebasic] Life After Quit

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2010 : Group Archive : Group : All Groups

From: Eugen Rosu <eugen.rosu@...>
Date: Thu, 10 Jun 2010 09:44:40 +0300
The next is a better example. Where to place fn FSpDelete( fileSpec ) ?
"kHICommandQuit" in "FBShell example" is OK, but...


'----------------------------------------------
_MyApplMenu = 1
_fileMenu = 2

BEGIN GLOBALS
     dim as FSSpec fileSpec
END GLOBALS

LOCAL
    dim as long menuIDm, itemIDm
LOCAL FN MenuDialog
menuIDm = Menu(_menuID)
itemIDm = Menu(_itemID)
SELECT menuIDm
CASE 254
CASE _MyApplMenu
'Here I want to kill "MyFile.txt" and I use
'fn FSpDelete( fileSpec ) and it doesn't work at all
fn FSpDelete( fileSpec )
CASE _fileMenu
SELECT itemIDm
CASE 1'Here I open a specific file from the disk
print "Here I open a specific file from the disk"
fn FSMakeFSSpec( system( _aplVRefNum ), system( _aplParID ), "MyFile.txt", @fileSpec )
open "O", 1, @fileSpec
CASE 2'Here I want to kill "MyFile.txt"
close 1
fn FSpDelete( fileSpec )
print "Here I want to kill 'MyFile.txt' and I use fn FSpDelete( fileSpec ) and that works great"
delay 5000
END
END SELECT
END SELECT
END FN

LOCAL FN BuildMenu
Apple Menu "About MyApplic"
Menu _fileMenu, 0,_enable,"File"
Menu _fileMenu, 1,_enable, "Open file/O"
Menu _fileMenu, 2,_enable, "Close/W"
END FN

LOCAL FN BuildWindow
Window 1
END FN

ON MENU FN MenuDialog
FN BuildWindow
FN BuildMenu

RunApplicationEventLoop()
'----------------------------------------------



Eugen R.