[need help] C++ Plugin Template can't figure out how to write a dock dialog
-
Hi, I Can’t figure out how to write a dock dialog. or an any kind of dialog/window.
In notepad++ C++ Plugin Template, I see there’s this
DemoDlg
example class defined inGoToLineDlg.cpp
/GoToLineDlg.h
but not used anywhere, and i can’t figure out how to use it on my own.here is file: “
GoToLineDlg.h
”#include "DockingDlgInterface.h" #include "resource.h" class DemoDlg : public DockingDlgInterface { public : DemoDlg() : DockingDlgInterface(IDD_PLUGINGOLINE_DEMO){}; virtual void display(bool toShow = true) const { DockingDlgInterface::display(toShow); if (toShow) ::SetFocus(::GetDlgItem(_hSelf, ID_GOLINE_EDIT)); }; void setParent(HWND parent2set){ _hParent = parent2set; }; protected : virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); private : int getLine() const { BOOL isSuccessful; int line = ::GetDlgItemInt(_hSelf, ID_GOLINE_EDIT, &isSuccessful, FALSE); return (isSuccessful?line:-1); }; };
im very comfortable with c++, and i know some basics about win32 api.
-
@ADe P.S. if anyone is interested I plan to write a notepad++ ctags plugin for code navigation, so i need a (dockable) dialog interface. yea, i know other n++ ctags plugins exist, but they’re either unmaintained (crashes on newest n++ versions) or buggy or just bad
-
@ADe said in [need help] C++ Plugin Template can't figure out how to write a dock dialog:
I Can’t figure out how to write a dock dialog. or an any kind of dialog/window.
Sadly, there is, to the best of my knowledge, no official, explicit documentation on how to create a docking dialog. There is an option I can offer.
I’ve created a Visual Studio template for making a C++ plugin for Notepad++ called NppCppMSVS. I have written fairly detailed documentation.
Included are examples of modal, non-modal and docking dialogs; settings that can be saved and restored; how to implement menu commands and how to respond to notifications; and the setup to use the C++ interface to Scintilla. It builds a working (though useless) plugin you can modify. However:
-
This template is not “official”; it isn’t endorsed by the author of Notepad++.
-
It hasn’t been around that long, so it isn’t exactly “battle tested.” So far, I’ve written one experimental plugin, Controlled Auto-indent, using it. To the best of my knowledge, no one else has used it yet.
-
It reflects my own coding style and preference, which might not be yours. In some cases, unraveling what I’ve done to use it as an example if you don’t want to do it “my way” could be tedious.
-
-
@Coises Very good. Looks like actually proper documentation!
I’ll take a look, thanks for sharing :D