SelectFolder Dialog not Closing

  1. 7 months ago

    David B

    11 Feb 2019 Pre-Release Testers, Xojo Pro

    Running MacOS 10.14.3

    I have a routine using the SelectFolderDialog class. I call it with showmodal, but when the folder is chosen, and the action button is clicked, the folder is returned, but the dialog window does not close.

    dim destination as FolderItem
    dim dlg as SelectFolderDialog

    dlg = new selectFolderDialog
    dlg.Title = "Select Source Folder "
    dlg.ActionButtonCaption ="Select"
    dlg.PromptText = "Select the volume or folder to that contains images to be processed"

    destination = dlg.ShowModal

    What am I not doing here?

  2. Bob K

    11 Feb 2019 Pre-Release Testers, Xojo Pro, Third Party Store Kansas City

    What are you doing just after dlg.ShowModal? It might be that whatever you're doing is so CPU intensive that the dialog isn't be removed.

  3. Jeff T

    11 Feb 2019 Pre-Release Testers Midlands of England, Europe

    Happens to me all the time when debugging.
    Is this in debug or released app?

  4. David B

    11 Feb 2019 Pre-Release Testers, Xojo Pro

    To Bob:
    Once I get the folder, I store it as a target to save converted images and I begin a process to recurse through a directory tree and convert images from tiff to jpeg. Is there some way to force the dialog to close before I start the conversion process?

    To Jeff:
    This is happening both in the debugger and the compiled version of the app. This is very annoying. There is not even a .close command to call on this, after the folderitem has been handed off.

  5. Bob K

    11 Feb 2019 Pre-Release Testers, Xojo Pro, Third Party Store Kansas City

    Is this process in a thread? If not, it should be so the UI doesn't lock up.

  6. Jeff T

    11 Feb 2019 Pre-Release Testers Midlands of England, Europe

    try setting dlg = nil once you have stored the folderitem into a variable.

    dim destination as FolderItem
    dim dlg as SelectFolderDialog
    
    dlg = new selectFolderDialog
    dlg.Title = "Select Source Folder "
    dlg.ActionButtonCaption ="Select"
    dlg.PromptText = "Select the volume or folder to that contains images to be processed"
    
    destination = dlg.ShowModal
    
    dlg = nil
    //now do stuff
  7. Tim S

    11 Feb 2019 Canterbury, UK

    @Bob K Is this process in a thread? If not, it should be so the UI doesn't lock up.

    If it were in a thread, he wouldn't be able to show a dialog anyway.

  8. Bob K

    11 Feb 2019 Pre-Release Testers, Xojo Pro, Third Party Store Kansas City
    Edited 7 months ago

    @Tim S If it were in a thread, he wouldn't be able to show a dialog anyway.

    You miss my point. You can *start* the thread right after the dlg.showmodal. Trust me, I know a thing or two about threads and UI.

  9. David B

    11 Feb 2019 Pre-Release Testers, Xojo Pro

    No the process is not in a thread-- I will try that.
    Thanks!

  10. Beatrix W

    11 Feb 2019 Pre-Release Testers, Third Party Store Europe (Germany)

    Some months ago there was a blog post from Ulrich Bogun to do a dialog with a delegate as workaround.

  11. Markus W

    11 Feb 2019 Pre-Release Testers #JeSuisHuman New Zealand, Auc...

    @Beatrix W Some months ago there was a blog post from Ulrich Bogun to do a dialog with a delegate as workaround.

    Shouldn‘t that have been fixed by now???

  12. Beatrix W

    11 Feb 2019 Pre-Release Testers, Third Party Store Europe (Germany)

    I don't think Xojo regards this as bug but as feature from macOS.

    Checking Feedback I found a verified bug <http://feedback.xojo.com/case/49730> which is only for debugging.

  13. Tim S

    12 Feb 2019 Canterbury, UK

    @Bob K You miss my point. You can *start* the thread right after the dlg.showmodal. Trust me, I know a thing or two about threads and UI.

    Ha yes. Oddly enough this is what I do. Except that it's not, initially, a dialog. I put up a small window to get the info I need from the user (using a dialog at that point), then launch the thread (or not) once the user clicks my Go button (and close the small window).

  14. Sam R

    13 Feb 2019 Pre-Release Testers, Xojo Pro, Third Party Store Hengchun, Pingtung, Taiwan

    @David B I have a routine using the SelectFolderDialog class. I call it with showmodal, but when the folder is chosen, and the action button is clicked, the folder is returned, but the dialog window does not close.

    I have this happen on 10.12.x, 10.13.x and 10.14.x, even with Objective-C applications.

    What's interesting to me is when it happens; the path to the file is garbage, which make me believe that this is a bug in the macOS where the xpc.opensave service (or whatever it's called) gets buggered. Normally a restart fixes it.

  15. David B

    13 Feb 2019 Pre-Release Testers, Xojo Pro

    Happily---
    I put the process in a thread and the dialog closes (eventually). I appreciate everyone's help on this. If I would only do as I am supposed to do, and not try to take shortcuts, I suppose I would not be having this conversation.

  16. Bob K

    13 Feb 2019 Pre-Release Testers, Xojo Pro, Third Party Store Kansas City

    Well, sometimes you don't know what you're supposed to do until you try it and it goes wrong.

    My XDC session is nominally titled "Xojo Design Mistakes" but it's really "Thankfully time travel hasn't been invented or my future self would go back in time and strangle my past self for such stupid mistakes."

or Sign Up to reply!