Class TNppDockingForm

Unit

Declaration

type TNppDockingForm = class(TNppForm)

Description

Default implementation of a docked plugin dialog

Hierarchy

Overview

Fields

Protected ToolbarData: TToolbarData;
Protected NppDefaultDockingMask: Cardinal;

Methods

Public constructor Create(AOwner: TNppForm; const DlgId: Integer); reintroduce; overload; virtual;
Public constructor Create(const NppParent: TNppPlugin; const DlgId: Integer); reintroduce; overload; virtual;
Public destructor Destroy; override;
Public procedure Hide;
Public procedure RegisterDockingForm(MaskStyle: Cardinal = DWS_DF_CONT_LEFT);
Public procedure Show; overload;
Public procedure Show(const Plugin: TNppPlugin; const DlgMenuId: integer); overload;
Public procedure UpdateDisplayInfo; overload;
Public procedure UpdateDisplayInfo(Info: String); overload;
Protected procedure OnWM_NOTIFY(var msg: TWMNotify); message WM_NOTIFY;

Properties

Public property CmdId: Integer read FCmdId default 0;
Published property OnDock: TNotifyEvent read FOnDock write FOnDock;
Published property OnFloat: TNotifyEvent read FOnFloat write FOnFloat;

Description

Fields

Protected ToolbarData: TToolbarData;

This item has no description.

Protected NppDefaultDockingMask: Cardinal;

This item has no description.

Methods

Public constructor Create(AOwner: TNppForm; const DlgId: Integer); reintroduce; overload; virtual;

This item has no description.

Public constructor Create(const NppParent: TNppPlugin; const DlgId: Integer); reintroduce; overload; virtual;

This item has no description.

Public destructor Destroy; override;

This item has no description.

Public procedure Hide;

This item has no description.

Public procedure RegisterDockingForm(MaskStyle: Cardinal = DWS_DF_CONT_LEFT);

Initializes the ToolbarData member and sends NPPM_DMMREGASDCKDLG.

This sets the style bitmask of the ToolbarData member to the combination of DWS_ADDINFO and the given MaskStyle. If this form's Icon property is set, the TToolbarData.IconTab field is assigned from the icon's Handle, and the DWS_ICONTAB flag will be added to TToolbarData.Mask.

Note
The initial dock position is saved in %AppData%\Notepad++\config.xml as a GUIConfig element with the DockingManager attribute; e.g.,

 {
     <GUIConfig name="DockingManager" leftWidth="200" rightWidth="582" topHeight="200" bottomHeight="200">
         <PluginDlg pluginName="HelloWorld.dll" id="2" curr="1" prev="-1" isVisible="yes" />
         <ActiveTabs cont="0" activeTab="-1" />
         <!-- ... -->
     </GUIConfig>
 }

You should delete this between launches when testing different configurations.

Parameters
MaskStyle [optional]
one or more bit flags for the TToolbarData.Mask field
Public procedure Show; overload;

This item has no description.

Public procedure Show(const Plugin: TNppPlugin; const DlgMenuId: integer); overload;

This item has no description.

Public procedure UpdateDisplayInfo; overload;

This item has no description.

Public procedure UpdateDisplayInfo(Info: String); overload;

This item has no description.

Protected procedure OnWM_NOTIFY(var msg: TWMNotify); message WM_NOTIFY;

Handles the DMN_FLOAT, DMN_DOCK and DMN_CLOSE Docking Manager messages.

Note
Because the Docking Manager signals its "children" dialogs through WM_NOTIFY, which is also broadcast by the Windows runtime, the likelihood of adverse interactions is high. The necessity of hacking your docked dialog's window attributes was discovered by this template's original developer in this discussion thread.

Newer development has tried to improve on Damjan Cvetko's insights, but there is probably no single solution for every use case. So, while many plugins will work fine using this method as is, be prepared to debug and edit this code path if your plugin starts freezing the editor in endless redraw loops.

Parameters
msg [in, out]
a TWMNotify structure (compatible with Windows' NMHDR)

Properties

Public property CmdId: Integer read FCmdId default 0;

The menu ID of the plugin command associated with this TNppDockingForm, assigned by Notepad++ during plugin initialization.

Note
It is CmdIdnot DlgId – that identifies a plugin command when sending API messages to the Notepad++ window. Using TNppPlugin.CmdIdFromDlgId wherever possible is recommended.

Published property OnDock: TNotifyEvent read FOnDock write FOnDock;

Optional handler for the DMN_DOCK message.

Published property OnFloat: TNotifyEvent read FOnFloat write FOnFloat;

Optional handler for the DMN_FLOAT message.