Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Open new tab for a new file

2013-05-07
2013-06-07
  • Hi,

    I'm trying to create a new tab to put content into. I'm not sure if it's properly called a buffer or a tab or a window or a document or a file or (etc).

    I've seen SCI_CREATEDOCUMENT but that seems to overwrite the current tab.

    I've seen reference to WM_COMMAND and IDM_FILE_NEW but I'm not sure how to use those, from my .NET/C# plugin. Can anyone give a simple example of how to achieve this with a few lines of code?

    Thanks,

     
  • Heinz
    Heinz
    2013-06-05

    I dont have c# code...but basically if you want to mimic a menu command "File - new" you can do something like this:

    ret = SendMessage (nppHnd , #NPPM_MENUCOMMAND , 0, #IDM_FILE_NEW)

    I dont have the value for #NPPM_MENUCOMMAND handy...but #IDM_FILE_NEW = 1001 (decimal)

    HTH
    Heinz

     
  • CorruptedFile
    CorruptedFile
    2013-06-07

    I don't know if you have figured this out yet, but I did it using the following line in the .NET plugin template:

    Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_MENUCOMMAND, 0, NppMenuCmd.IDM_FILE_NEW)