Skip to content

Displaying in Paratext

Tom Bogle edited this page Aug 19, 2021 · 9 revisions

Plugins derived from IParatextWindowPlugin and IParatextMainWindowAutomaticPlugin can display information in a Paratext tab. ("Tab" is how Paratext refers to a display element that can have its own menu, whether it is a panel, tab pane, autohide, or docked.) These plugins start when a menu item is clicked. In the plugin's method that is associated with the menu item, the plugin should

  1. Receive an instance of IWindowPluginHost passed as a parameter.
  2. Construct a plugin-defined control derived from EmbeddedPluginControl. That control will often be a container holding other controls. Paratext will size the control to fit in its window.
  3. Pass that control to the ShowEmbeddedUi method of the passed-in IWindowPluginHost instance.

The ShowEmbeddedUi will cause Paratext to create a tab to host the plugin's content. Paratext will then call the OnAddedToParent method of the control, providing the IPluginChildWindow for the control's parent tab. At this time, the control can add handlers for the following events from the parent:

  • SaveRequested
  • WindowClosing
  • ProjectChanged
  • VerseChanged

The plugin can also populate the control with its contents.

  • First, the user clicks the menu in Paratext. Paratext calls the Clicked() method in the plugin.
  • Next, in the Clicked() method the plugin can create a new instance of the control that will be embedded into Paratext.
  • The plugin will call ShowEmbeddedUI(control) in Paratext to add the created control to Paratext.
  • Then, Paratext will call the OnAddedToParent() method on the control.
  • Finally, OnAddedToParent() can subscribe to events on the owning Paratext child window.

For the plugin to create its own menu in the parent window, it should use a MenuStrip and ToolStripMenuItem to construct a menu hierarchy. It then calls Controls.Add to add the MenuStrip to the plugin control. Paratext will see the MenuStrip and create the menu for the plugin control.

After initialization, Paratext interacts with the plugin through the event handlers.

Clone this wiki locally