NotepadPlusPlusPluginPack.Net icon indicating copy to clipboard operation
NotepadPlusPlusPluginPack.Net copied to clipboard

SetCommand() has unneeded parameter

Open dail8859 opened this issue 8 years ago • 2 comments

SetCommand() currently takes an index as its first parameter. It uses this to set the _cmdID field. However, this is a field N++ sets internally. All of my C++ plugins just set the initial value of _cmdID to 0 and it has always worked fine. Since removing that parameter would break backwards compatibilty with older versions of the plugin pack you may want to wait till a "stable" 1.0 release or just do it now since it is very easy for developers to make the change.

Something else to note, there are cases where you need to store the index, like this example. Instead of making the developer manually count what index it is getting inserted at, you can make SetCommand() return the newly added index, so that the example I referenced will look like this:

idMyDlg = PluginBase.SetCommand("MyDockableDialog", myDockableDialog);

dail8859 avatar Feb 16 '17 13:02 dail8859

great maybe it fixes #17

kbilsted avatar Feb 23 '17 22:02 kbilsted

Hmm, not sure if it is related or not. I would think if wrong command IDs are getting used it would run into issues much sooner.

dail8859 avatar Feb 24 '17 14:02 dail8859