[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 -
@ADe Alternatively, you can have a look at https://github.com/ThosRTanner/Docking_Dialogue_Interface/tree/master which is a library you can add as a submodule to your repo which wraps up the dialogue interface. And yes, obviously it reflects my own tastes (and strangenesses).
I used it heavily when working on https://github.com/ThosRTanner/notepad-pp-linter/
-
Okay well i’m new here, not new to programming, however… Is there anyway to get this to work in VSC++ 6.0? Laugh all you want, i just do not like the .NET that was added in, and I just cant bring myself to use it, I mostly use vb6 for windows app programming, and c/c++ for more serious things which don’t worry too much about a User Interface.
Im sure theres not, because of the fact your using vs 2022, and that has to mean without the dependencies, the project wont work either way. However is there a way to convert the project to vc++ 6.0? or I should ask is there a program out there that can do this, or could you do it if its possible, load the source code up into a vc++ 6.0 project. and save / upload it as a separate download?
If not I am sorry for wasting your time, at least I got you laughing right?.. :( i’m not laughing I really cant stand the whole .NET thing… I wish they had never done any of that, It completely f’ed up Microsoft Visual studios…
-
@Chris-Fesko The binary interface to Notepad++ is entirely standard C (not C++).
That includes the docking dialogs, even though the existing model is presented in C++. If you look carefully, you’ll find that all the communication across the host/plugin boundary is plain C.
So you can absolutely write a plugin in anything that can present a C interface and compile to a DLL.
-
@Chris-Fesko using vs 2022 doesn’t mean the code is using .net. My code certainly isn’t. It’s standard c++ throughout (though it is c++20 so i’m not sure how well that work with vc++ 6.0)