Code: Select all
Global sgCurrentFile.s = "C:\MyFile.txt"
Procedure SaveFileAs()
;---------------------
Static sDefaultSaveAs.s = GetPathPart(sgCurrentFile) ;Line 5: Bad parameter type: a string is expected.
sDefaultSaveAs = SaveFileRequester("Save File As", sDefaultSaveAs, "*.txt|*.txt|*.*|*.*", 0)
MessageRequester("Save File As", sDefaultSaveAs + " Saved", #PB_MessageRequester_Ok | #MB_ICONINFORMATION)
EndProcedure
SaveFileAs()
The reason for the failure is not "Bad parameter type: a string is expected.", it is "Only literal expressions are valid for 'Static'"
Isn't that a shame though? I just want to initialise the static var with the currently active file for the first time SaveAs is called, so the file browser will open the folder most likely to be used.