AskFile(VAR PtexFileName : Text[1024];pblnImport : Boolean) : Boolean // AskFile // IMPORTANT : you can also use Codeunit 412:"Common Dialog Management" // Asks the user for a filename // PARAMETERS : // VAR PtexFileName : INPUT : Default filename // (a defaultname, default path or default extension can be given) // OUTPUT : Selected filename // pblnImport : TRUE : select filename for import/reading // FALSE : select filename for export/writing ltexHelp := PtexFileName; IF pblnImport THEN BEGIN ltexHelp := lrecObject."BLOB Reference".IMPORT(ltexHelp,TRUE); END ELSE BEGIN lrecObject.SETRANGE(Type,lrecObject.Type::Table); lrecObject.FIND('-'); lrecObject.CALCFIELDS("BLOB Reference"); ltexHelp := lrecObject."BLOB Reference".EXPORT(ltexHelp,TRUE); END; IF ltexHelp <> '' THEN PtexFileName := ltexHelp; EXIT(ltexHelp <> '');
LtxtHelp := txtTheFileName; IF AskFile(LtxtHelp,TRUE / FALSE) THEN txtTheFileName := LtxtHelp;The IF THEN is needed to avoid that the value in "txtTheFileName" is removed if the function is called but then cancelled.
Comments
Very good help, saved me some headaches.
thomas