The following appeared to be working but now just locks up on upon pressing Save and doesn’t respond to a break immediately after f=dlg.showmodal so I am stuck as to how to debug. The loop on the for next has a value which has been checked before pressing save, what else can I check?
Dim tout as textoutputstream
Dim x as integer
Dim a As String
Dim f as folderItem
Dim dlg as SaveFileDialog
Var textType As New FileType
textType.Name = "text/plain"
textType.Extensions = "txt;text"
dlg=New SaveFileDialog
dlg.InitialFolder = SpecialFolder.Documents
dlg.Filter = textType '"text/plain"
if sseparator = 1 then
//colon
dlg.promptText= App.kFileExportWordClueList1 '"Export as a Colon separated text file."
else
//tab
dlg.promptText= App.kFileExportWordClueList2 '"Export as a Tab separated text file."
end if
dlg.SuggestedFileName="Untitled.txt"
dlg.Title= App.kFileExportWordClueList
f=dlg.ShowModal
if f <> Nil then
tout = TextOutputStream.Create(f)
if tout <> nil then
for x = 1 to Totalwords
if sseparator = 1 then
//colon
a = list(x) + chr(58) + clist(x)
else
//tab
a = list(x) + chr(9) + clist(x)
end if
tout.writeline a
next
tout.close
end if
end if
dim d as new SaveFileDialog
dim f as FolderItem = d.ShowModal
Break
in a button then the debugger stops at the break. What is happening, though, is that macOS doesn’t hide the dialog in a timely manner. Ulrich Bogun made an example using a delegate which makes the dialog go away immediately. GuiSavvyGetOpenFolderitem or something.
I am still having a problem with the dialog locking up my program.
If I use the Dialog to navigate to a different directory and then back to Documents it works but if I simply call the the Dialog and press save it locks the program.
What am I doing wrong?
I can see mouse enter events firing in the background of the frozen Dialog, would that have anything to do with it?
I have changed all the deprecated Dialog code out like initial directory etc but it still freezes. As I mentioned above if you navigate to a new directory it works but if you leave it where it is pointed it freezes.
No luck with Jeff’s suggestion
Is there something else to set or any other way to see what is going on between, I can’t be the only one seeing this or whatever I do in the background in my projects is causing it as it was an issue in the last project also.
I found Beatrix mention of Ulrich’s solution but I would need a downloadable version to play with as it looks a bit advanced for my skills and I don’t read German. Thoughts
Create new a small project using the exact code, constants etc. you show up above right up until you call f=dlg.ShowModal and see if it shows the same issue.
If does the same thing and doesn’t respond, share the project and we’ll take a look.
If it acts differently then let us know.
Agree with Julian here, it sounds like there’s a problem with your application on the OS, or worse a File System issue.
I personally am leaning towards the SaveDialog encountering an error and the OS is swallowing the error, rather than to crash and tell you about the error (this change happened in macOS 10.14).
This is what the dialog looks like.
It will work for a few saves and then lock up and other times it will lock on the first save??
Finder doesn’t show the app as not responding, if you put another app over the top and then remove it, the dialog refreshes but buttons still unresponsive.
Once you’ve opened it, select your application in the left hand list.
Then select “Debugging Tools” from the “View” menu.
Click on “Crash on NSException”, then close the window.
Now try to perform the actions in your application that make it lock up, if it is a NSException, the application will crash and you’ll be able to look at the crash report to see where.
You can also use the “Log Data” function of App Report to browse (and filter) the log information, which might help.
That’s a nice bug reproduction project there Martin, it look/sounds similar to the experiences here <https://xojo.com/issue/54984>. I can make it happen on Catalina 10.15.4 but not on Mojave 10.14.6. It might be worth putting in as a fresh feedback ticket so it has a better chance of being addressed quickly.
@Sam_Rowlands I tried your app, very nice, here’s the non-fatal catch if it helps:
Before 10.14, your application would crash when it encounters an NSException. With 10.14 Apple made a change to no longer crash the application, instead they terminate the current thread, but leave the application running. Sure it reduces application crashes, but the downside is that it makes it almost impossible for most developers to know where the problem is.
This option re-enables the old functionality, which helps you, I and other developer to not only see where an application is going wrong, but more often than not, it also tells you WHY!
Generally means Apple changed something regarding a parameter, and the developer hasn’t updated their code to match. I get a lot of these with Core Image over various versions of macOS, with no documentation to show that they changed the types. I did have one property very kindly log what the “new” values should be.