XOJO 2019r3.2 - Windows Desktop
Is it possible to test the Application.OpenDocument handler in debug mode.
I.e. testing it without installing the app in windows (msi).
I did a build and then i drag/drop a file to the builded .exe file, but that does not work for tetsing the OpenDocument handler.
The property i created ‘iconDrop As Boolean’ is set to true in the OpenDocument handler, but this property is not true when the default window is loading…
Well you could get a document in the App.Open event and call App.OpenDocument with the file as a parameter.
Var f As FolderItem = FolderItem.ShowOpenFileDialog ("special/any")
If f <> Nil Then OpenDocument (f)
I don’t know if it exactly what you need but it will let you test the code on OpenDocument.
If you set the “Debug Command Line Arguments” to the NativePath of the document you can test the
OpenDocument event on macOS. I’m not sure if it works on Windows as well, but it would be worth a shot.
Run Paused lets you create & then drag drop an item onto the application to be debugged
Yes, it does work on Windows, also.
Solution from Tim does trigger the OpenDocument handler .
But a little test (a breakpoint in both the handlers) has for me a bizar result.
I always thougt that the App.OpenDocument is handled before the DefaultWindow.Open handle.
Apparently the DefaultWindow.Open is handled before the App.OpenDocument handle.
Is this correct ???
You should turn implicit instance off. That way you’re in control of when the window is opened.
Ok Tim thanks. You put me to the solution.
I did not set the implicit instance off.
In the App.Open handler I was setting a property from the defaultwindow.
This setting was making the defaultwindow to open, and that before the OpenDocument.
I recreated the property in my globals so the setting was no more opening the defaultwindow.