OpenDocument event not called after dialog opens file?

Should an OpenDialog that opens a file of type listed in the FileTypes cause App.OpenDocument to fire?
It isn’t firing?

No. You misunderstand the use of OpenDocument.
http://documentation.xojo.com./index.php/Application.OpenDocument_event

I guess what I’m asking then is “What is an OpenDocument Method” and how do you create one?

Do you mean you just want to open and parse the folderitem passed to you by the user selecting a file?
That depends on what the file is.
Text file? Binary File? Picture file? XML file? etc, etc.
Post a bit more info regarding the files you are working with, or consult the ample examples folder with Xojo or the many tutorials online.

No. I know how to do that. What I’m asking is what is the METHOD which calls the event. How does the event get fired?
It’s not clear what this method is? The LR states OpenDocument method.

The OpenDocument Event is fired when the user drops a file on your app or double clicks a file which is owned by your app.
If you want to cause that event to fire via code, use the openDocument Method to pass a folderitem to that event
http://documentation.xojo.com./index.php/Application.OpenDocument_method

[quote=370182:@Arthur Gabhart]No. I know how to do that. What I’m asking is what is the METHOD which calls the event. How does the event get fired?
It’s not clear what this method is? The LR states OpenDocument method.[/quote]
The LR states “The user has double-clicked on a document whose creator matches the application’s creator or the OpenDocument method was called.”

So, this means any time Finder or Explorer are opening a document with your app. (double click, right-click>open, drag to dock icon, drag to Finder icon, anything else like that).

What the LR means by “or the OpenDocument method was called” is that you may also call it. This way you can centralize your document opening code to one spot (the OpenDocument Event).

So, for example using an OpenDialog as you had originally posted about, this might look like:

dim dlg as new OpenDialog
dim fOpen as FolderItem = dlg.ShowModal

if fOpen <> nil and fOpen.Exists then
  App.OpenDocument(fOpen)

end

Thanks Tim. So. To be redundant, if you have an OpenDocument method in the App it will fire that event OpenDocument?

I did a quick text search of the examples and it didn’t show.

You don’t implement the method it exists already, like App.DoEvents or App.YieldToNextThread.

I would be happy if you could post an example that makes that work because I am thoroughly confused.
Not needed, because I’m done persuing this.

https://www.dropbox.com/s/qzf3pl1cg7qfr7m/open.xojo_binary_project?dl=1

You can drop a .txt file on it’s dock icon, or the application itself in the Finder. You will see the name of the text file you dropped on it. You can also click the button on the window to go through the OpenDialog example explained in this thread.

Both means of opening/selecting the file go through the App.OpenDocument event.

Thanks. I’ll look at it.
My confusion comes from this RecentItems example I have that uses it as an event, but if do that on an app of my own it doesn’t work.

To be clear, it’s “App.OpenDocument”, not “OpenDocument”. You must use the “App.” prefix.