Maybe a Bug?

Still on this merry-go-round
I have the following code to open .txt files only

[quote]Var textType1 As New FileType
texttype1.Name = “text/plain”
texttype1.Extensions = “txt;text”

dlg=New OpenDialog
dlg.initialDirectory = SpecialFolder.Documents

dlg.promptText=App.kAutoInstruct2

dlg.Title=app.kOpenBtn
dlg.Filter= textType1
[/quote]

The first time the dialog is called it shows both .txt and .rtf files.
But if you cancel and then call the dialog again it shows only .txt files as expected??

The following

[code]Var textType1 As New FileType
texttype1.Name = “text/plain”
texttype1.Extensions = “txt;text”

dlg=New OpenDialog
dlg.initialDirectory = SpecialFolder.Documents

dlg.promptText=“prompt”

dlg.Title=“title”
dlg.Filter= textType1

dim f as folderitem
f = dlg.showmodal[/code]

works as expected here on 2019r3.1. I made dlg a property on Window1 of type FolderItemDialog

What version of xojo are you using?
If you put the above code into a new project and trigger it on a button does it work as expected for you?

Hi Julian
Yes that works in a new project but no different in my project.
I’m using r3.1 and latest OS.

  • I have MyFiletypes for the files my project own plus I dynamically makes text and html ones inside various methods
    Should I add text/plain to myfiletypes rather than doing it dynamically in the methods I use and if I am doing it multiple times in various methods do they conflict or are they protected
    eg if I define the following in 2 separate methods is it an issue
    Var textType1 As New FileType
    texttype1.Name = “text/plain”
    texttype1.Extensions = “txt;text”

Var textType1 As New FileType
texttype1.Name = “text/plain”
texttype1.Extensions = “txt;text;rtf”

It’s definitely something I’m doing wrong as another error surfaced recently also.

  • My Save dialogs have started locking up when I click the save button, which I don’t seem to be able to following in the debugger :frowning:

Do you have any threads or timers running while you’re using this Dialog?
Have you used DoEvents, Declares or 3rd party plugins anywhere in your project?

[quote=478775:@JulianS]Do you have any threads or timers running while you’re using this Dialog?
Have you used DoEvents, Declares or 3rd party plugins anywhere in your project?[/quote]
And what did you have for breakfast this morning?

Weetabix :slight_smile:

I was asking the OP, since it seems from your post that just about anything could be the cause of his issue :slight_smile: Timers? Really?

Oh hehe woosh :slight_smile:

Yeah timers, they’re dealt with using events (at least on windows, not 100% sure about mac but probably) so technically you could have event saturation which could lock up the dialog, just plucking things outta my a… the air :wink:

The sad fact is that dialog filters have never consistently worked (at least not for me).

search for rtf in your project .
you could add a method that return a FileType.
in this method you add a system.debuglog to see when it is used.

also use break points.