How to remove to separation lines in the menu?
-
Hello,
I am a new developer for several days. I make my own plug based on the ‘Npp Converter’.
But I am confused about the separation lines in the menu.
Could anyone tell me how can I remove them? It seems a simple question but I still can’t figure out how to customiz it.Thanks!
The separation lines in the red box:
-
The first question, probably for you, is, where did these separators come from?
Next, I would see HERE.
-
@alan-kilborn thanks for your reply Alan. I am still confused. Do you know how to add a separator in the menu?
I just modified the code as below. But don’t have any clew where the lines come from.void commandMenuInit() { //setCommand(1, TEXT("HEX -> ASCII"), hex2Ascii, NULL, false); //setCommand(2, TEXT("---"), NULL, NULL, false); //setCommand(CONVERSIONPANEL_INDEX, TEXT("Conversion Panel"), conversionPanel, NULL, false); //setCommand(4, TEXT("---"), NULL, NULL, false); //setCommand(5, TEXT("Edit Configuration File"), editConf, NULL, false); //setCommand(6, TEXT("About"), about, NULL, false); setCommand(0, TEXT("Filter1"), filterRun1, NULL, false); setCommand(1, TEXT("Filter2"), filterRun2, NULL, false); setCommand(2, TEXT("Filter3"), filterRun3, NULL, false); setCommand(3, TEXT("Edit Configuration"), conversionPanel, NULL, false); setCommand(4, TEXT("About"), about, NULL, false); }
-
@lifehack-nerd said in How to remove to separation lines in the menu?:
setCommand(2, TEXT(“—”), NULL, NULL, false);
this, normally, triggers the separator.
I assume there is some code that assumes there are more menu items and sends voidptr(0) instead. -
@ekopalypse Thank you! Is there official document about how to customize the menu?
Find where they come from, then know how to remove them like Alan said. -
Depends, the first level of the menu is created by Npp via the getFuncsArray callback, but other levels, obviously if you want to have menus with multiple levels, need to be handled by your plugin and need to be created/handled using the msdn documentation that @Alan-Kilborn pointed to.
-
@lifehack-nerd said in How to remove to separation lines in the menu?:
Thank you! Is there official document about how to customize the menu?
“yes”, in the plugin template. You can modify the menu items as you’ve shown, and I typically use:
setCommand( 3, TEXT( "-SEPARATOR-" ), NULL, NULL, false );
for separators so it’s pretty obvious it’s a separator (note the text “-SEPARATOR-” does not actually appear in the menu, just the line). You will ALSO NEED TO CHANGE in
PluginDefinition.h
//-----------------------------------------------// //-- STEP 2. DEFINE YOUR PLUGIN COMMAND NUMBER --// //-----------------------------------------------// // // Here define the number of your plugin commands // const int nbFunc = 21;
the
nbFunc
which is the number of menu items you have. If this doesn’t agree, you’ll get a shorter menu, or a bunch of extra separator lines. Note this number must be the TOTAL of menu items INCLUDING seprators, so in your example code above, you should set:const int nbFunc = 5
since you show:
setCommand(0, TEXT("Filter1"), filterRun1, NULL, false); setCommand(1, TEXT("Filter2"), filterRun2, NULL, false); setCommand(2, TEXT("Filter3"), filterRun3, NULL, false); setCommand(3, TEXT("Edit Configuration"), conversionPanel, NULL, false); setCommand(4, TEXT("About"), about, NULL, false);
Cheers.
-
@michael-vincent WOW IT’S THE ANSWER! It works! Thank you very much Michael!
-
@michael-vincent Hi Michael, do you know how to make our own plugins can be searched in the Plugins Admin? like offical document indicates how to make it?
I hope that my plugin can be searched in it. I will be very proud of it though it’s still under developing. -
@lifehack-nerd said in How to remove to separation lines in the menu?:
how to make our own plugins can be searched in the Plugins Admin?
I think you want THIS.
-
@alan-kilborn Yes! Thank you!
-
Just a tip: You might want to discuss your plugin and what it does in a new thread on this site. You may find that, while very useful to you, your plugin may not have a wider appeal, or there may already be a plugin existing (that you don’t know about) that covers its functionality.
-
@alan-kilborn Well, I need some time to read the document because my English is not good. But I want to ask first:
1.If my plugin do not have a wider appeal, will I be rejected? How to make that judgement?
2.there may already be a plugin existing (that you don’t know about) that covers its functionality, will I be rejected?
Thanks! -
@lifehack-nerd said in How to remove to separation lines in the menu?:
1.If my plugin do not have a wider appeal, will I be rejected? How to make that judgement?
2.there may already be a plugin existing (that you don’t know about) that covers its functionality, will I be rejected?I don’t think it will be rejected - there are some plugins up there that have overlapping functionality. I think @Alan-Kilborn 's point is more about “work smarter, not harder” - you’re asking good questions and getting help here, but a more fundamental question might be:
“Hey, is there a way or plugin to do ‘X’?”
and you may find, yes, there are 2 plugins and a way to script it in either PythonScript and / or NppExec.
The other reason to describe your plugin here is there may be some who are willing to test functionality for you or even help develop it if it “scratches an itch”.
If you’re developing a plugin just for the experience, that works fine too! Good luck :-)!
Cheers.
-
@michael-vincent Thanks Michael! Very helpful!
Is there a plugin to search multi text tag and display the result?
I am an embedded software engineer and often need to analyse logs. I want to make a multiline search plugin, because the power events have unique log pattern, the device communication events and the brightness events of the screen or other events all have their own patterns. I want fill the log patterns in the plugin and search them totally. Then I can analyse them in the sequence base on timestamp.I almost finish it but blocked by the separator. So ask questions here. The function is indeed “scratches an itch” but … maybe I am just too eager to have relationship with a widely used editor and just do it before ask. Haha.
-
@lifehack-nerd said in How to remove to separation lines in the menu?:
Is there a plugin to search multi text tag and display the result?
I am an embedded software engineer and often need to analyse logs. I want to make a multiline search plugin, because the power events have unique log patternHave a look at AnalysePlugin which is for analyzing log files and allows multiple search patters (including regex) and can color the file or output to a search window. That may cover 80% of your use case - feel free to continue your development either way.
Cheers.
-
@michael-vincent This plugin is good especially it can color the found logs and the full log reacts when click on the found log. It was started 10 years ago! I am going to terminate my work.
-
@lifehack-nerd said in How to remove to separation lines in the menu?:
This (Analyse) plugin is good especially it can color the found logs and the full log reacts when click on the found log. It was started 10 years ago! I am going to terminate my work.
Yea…I certainly didn’t want to discourage your work, but putting effort into something just to discover you’ve reinvented the wheel is a bummer.
-
@lifehack-nerd said in How to remove to separation lines in the menu?:
It was started 10 years ago! I am going to terminate my work.
I think just recently updated to address the N++ 8.3 breaking changes. So the author is active thus if you want to contribute, you may ask him/her on the plugin’s site and perhaps help improve that plugin for the good of all.
Cheers.
-
@alan-kilborn Yeah, I didn’t know there already had a good wheel here.
How do you avoid this kind of thing happened?
If you have a idea, will you annouce to everybody or trend to just start it?
Thanks!