Community
    • Login

    How to update title of plugin

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 2 Posters 290 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • SinghRajenMS
      SinghRajenM moderator
      last edited by SinghRajenM

      I am working on a plugin where I need to update the title of the plugin based on the selected document.

      How this can be done.

      tTbData tbData;
      
      tbData.uMask = DWS_DF_CONT_BOTTOM | DWS_ADDINFO;
      tbData.pszName = TEXT("pszName");
      tbData.pszAddInfo = TEXT("pszAddInfo");
      tbData.dlgID = 0;
      tbData.iPrevCont = -1;
      
      SendMessage(_hParent, NPPM_DMMREGASDCKDLG, 0, (LPARAM)&tbData);
      

      A referenced bug: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/2389

      I know that NPPM_DMMUPDATEDISPINFO accepts the handle instead of tTbData. Hence, this bug might have been marked invalid.

      Is there any way to update the title?

      1 Reply Last reply Reply Quote 0
      • rdipardoR
        rdipardo
        last edited by

        AFAIK NPPM_DMMUPDATEDISPINFO is only for updating the tbData.pszAddInfo field, i.e., the text in the title bar of the dialog, e.g.:

        1. before sending NPPM_DMMUPDATEDISPINFO

        before-nppm_dmmupdatedispinfo.png

        2. after sending NPPM_DMMUPDATEDISPINFO

        after-nppm_dmmupdatedispinfo.png

        That may not be what you want. If you’re talking about the Plugins menu on the main application’s tool bar, try NPPM_GETMENUHANDLE instead: https://npp-user-manual.org/docs/plugin-communication/#2049nppm_getmenuhandle

        SinghRajenMS 1 Reply Last reply Reply Quote 5
        • SinghRajenMS
          SinghRajenM moderator @rdipardo
          last edited by

          @rdipardo this is what I wanted. Thanks!

          I wanted to change the title of plugin based on the filename.
          e.g. Json Viewer Panel - new 1 to Json Viewer Panel - new 2 when user switches from new 1 to new 2

          image

          Adding tbData.pszAddInfo works. However, I does not have control over delimiter. E.g. changing - to : or something else. But I am ok with - to as well.

          rdipardoR 1 Reply Last reply Reply Quote 1
          • rdipardoR
            rdipardo @SinghRajenM
            last edited by

            @SinghRajenM said in How to update title of plugin:

            Adding tbData.pszAddInfo works. However, I does not have control over delimiter.

            Gotcha. As you said above, the LPARAM must be a handle to the docking dialog. An example involving an instance of StaticDialog shows _hself being passed.

            The - separator is indeed fixed. It is only drawn when pszAddInfo is not NULL, but I don’t know of any public method for customizing it.

            SinghRajenMS 1 Reply Last reply Reply Quote 3
            • SinghRajenMS
              SinghRajenM moderator @rdipardo
              last edited by

              @rdipardo

              The - separator is indeed fixed.

              Yes, it is fixed as we can see it here. Also, it seems we need to ensure tbData.pszAddInfo remains valid. If you want to change anything there, update the text on the original pointer.

              I feel, instead passing _hself to LPARAM, it should pass tTbData to NPPM_DMMUPDATEDISPINFO.

              Anyway, - is very minor stuff here. I am good with it. Thanks for the help on this.
              Cheers!

              1 Reply Last reply Reply Quote 1
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors