Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:29 pm
by cnwdad1 >> Wed, 7 Jan 2004 21:03:02 GMT
Take a look at the documentation for the "CMDFileOpen" and "CMDFileSave" classes, in the EncycloSys.pdf document. The following is an example of a method I have implemented on the "File" class using the CMDFileOpen class:
cnEcSetOpenName(pMustExist:Boolean; pCreatePrompt:Boolean; pFileFilter:String):Boolean updating;
// ------------------------------------------------------------------------- -------
// Created: 17 August 2001 by cnwdad1
//
// Purpose: This method will prompt the user to select (or enter) a file name,
// and will then use that name to set the receiver's file name.
//
// Parameters: pMustExist - If true, then the file being opened must already exist.
// pCreatePrompt - If true, the user will be prompted to create the
// file if it doesn't already exist.
// pFileFilter - The file-type filter string.
//
// Returns: True if the file name was successfully set, otherwise false. //
// Changed On Changed By Reason
// ---------- ---------- --------------------------------------------------- ----
//
// ------------------------------------------------------------------------- -------
vars
isSuccessful : Boolean;
fileOpenObj : CMDFileOpen;
begin
isSuccessful := false;
create fileOpenObj;
fileOpenObj.fileMustExist := pMustExist;
fileOpenObj.createPrompt := pCreatePrompt;
if pFileFilter <> null then
fileOpenObj.filter := pFileFilter;
endif;
if fileOpenObj.open = 0 then
self.fileName := fileOpenObj.fileName;
isSuccessful := true;
endif;
epilog
delete fileOpenObj;
return isSuccessful;
end;
regards,
darrell.