How to update title of plugin
-
I am working on a plugin where I need to update the title of the plugin based on the selected document.
How this can be done.
tTbData tbData; tbData.uMask = DWS_DF_CONT_BOTTOM | DWS_ADDINFO; tbData.pszName = TEXT("pszName"); tbData.pszAddInfo = TEXT("pszAddInfo"); tbData.dlgID = 0; tbData.iPrevCont = -1; SendMessage(_hParent, NPPM_DMMREGASDCKDLG, 0, (LPARAM)&tbData);
A referenced bug: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/2389
I know that
NPPM_DMMUPDATEDISPINFO
accepts the handle instead oftTbData
. Hence, this bug might have been marked invalid.Is there any way to update the title?
-
AFAIK
NPPM_DMMUPDATEDISPINFO
is only for updating thetbData.pszAddInfo
field, i.e., the text in the title bar of the dialog, e.g.:1. before sending
NPPM_DMMUPDATEDISPINFO
2. after sending
NPPM_DMMUPDATEDISPINFO
That may not be what you want. If you’re talking about the
Plugins
menu on the main application’s tool bar, tryNPPM_GETMENUHANDLE
instead: https://npp-user-manual.org/docs/plugin-communication/#2049nppm_getmenuhandle -
@rdipardo this is what I wanted. Thanks!
I wanted to change the title of plugin based on the filename.
e.g.Json Viewer Panel - new 1
toJson Viewer Panel - new 2
when user switches fromnew 1
tonew 2
Adding
tbData.pszAddInfo
works. However, I does not have control over delimiter. E.g. changing-
to:
or something else. But I am ok with-
to as well. -
@SinghRajenM said in How to update title of plugin:
Adding
tbData.pszAddInfo
works. However, I does not have control over delimiter.Gotcha. As you said above, the
LPARAM
must be a handle to the docking dialog. An example involving an instance ofStaticDialog
shows_hself
being passed.The
-
separator is indeed fixed. It is only drawn whenpszAddInfo
is notNULL
, but I don’t know of any public method for customizing it. -
The - separator is indeed fixed.
Yes, it is fixed as we can see it here. Also, it seems we need to ensure
tbData.pszAddInfo
remains valid. If you want to change anything there, update the text on the original pointer.I feel, instead passing
_hself
toLPARAM
, it should passtTbData
toNPPM_DMMUPDATEDISPINFO
.Anyway,
-
is very minor stuff here. I am good with it. Thanks for the help on this.
Cheers!