SelectAll oddities with SaveDialog

In the following procedure, if the first line is enabled, the procedure blows through to the end with no pauses. The GetText and SaveDialog are stacked and the zlog’s “X” is logged. Run it again and it only gets to the GetText. The next run tends to go back to the first result and so on.

If I disable the GetText section, it runs a little closer to what’s expected but gets an error that lvPath does not exist at the end.

With that first line disabled it runs as desired. Including or excluding SelectAll makes all the difference.

;SelectAll
RemoveAllSummaries
Let lvData = ""
ArrayBuild lvData,cr(),"",exportline()

Let lvDataSet = "CompanyName"
gettext "Name of Data Set?",lvDataSet
If lvDataSet = "" Stop EndIf

Let lvSavePath = dbfolder()+"DataSources/"+lvDataSet+"/"
If pathexists(lvSavePath) = 0
    MakeFolder lvSavePath
EndIf

Let lvPath = ""
Let lvFileName = lvDataSet+" Data.txt"

savedialog lvPath,
    "InitialPath",lvSavePath,
    "FileName",lvFileName,
    "FileTypes",".txt",
    "Prompt","Save Company Data",
    "CanCreateFolders",true()

If lvPath = ""
    Rtn
EndIf

zlog "X"
Filesave lvPath,lvData

And yes, I know that ArrayBuild does not require me to SelectAll.

I encountered no problems running it regardless of the first line, but it is a very small database. I ran it on a slightly larger database (900 rows and 120 fields) also with no problems.

Thanks for that, Tom. After more testing I determined that it was related to the active form. Going to the data sheet it worked properly.

The key form of the file has a couple of Text Lists. As it turned out, eliminating one that has an arraymultisort( made it work without those issues. Oddly, I used Undo to restore the TextList and it continued to work. :confounded: Alas, the hours I spent spinning my wheels on this trying to figure out what was wrong with the procedure. I hope it will stayed “fixed”.

I ran into another variation of this bug with a savefiledialog and a form with a Text List. In this case I get an error from _DiskLib:SAVEFILEDIALOG that fileChoice does not exist. Closing the form eliminates the error, as does inserting some other action after the SelectAll, or eliminating any selecting.

Let lvFile = ""
Let lvFolder = ""
SelectAll
Let lvFile = "ExportData.txt"
savefiledialog lvFolder,lvFile, "Save Export Data as:"

This also seems to relate to selecting causing issues in GetText doesn't pause