OpenDocument() debugging


I want to use the OpenDocument event. But how can I simulate that event in debug modus?


In the Shared Build Settings there is a parameter named “Command Line Arguments”. If you put the name of a test file, including the full path, in this field the OpenDocument event will be called when the app starts. You should be able to then break into the debugger by setting a breakpoint at the top of the event handler.

  • Place something in the Command Line Argument in the Shared build settings.
    This will fire the OpenDocument event.

in the OpenDocument event, set a folderitem to the file you want to open your app. For instance :

  item = SpecialFolder.Desktop.child("toto.txt")

In the compiled app, item contains a folderitem with the file that was opened. In this instance we just fill the event variable with a folderitem. For the build, just comment that line.

Thanks for the replies, but where can I find those Shared Build Settings?
RB 2012 over here :slight_smile:

In RB :

  • Select App in the project.
  • In the right pane, at the bottom, under Debugger, ‘CommandLineArgs:’. Click on ‘…’

Thanks Mr Bujardet.