• Login
Community
  • Login

How to update title of plugin

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
5 Posts 2 Posters 304 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.
  • S
    SinghRajenM moderator
    last edited by SinghRajenM Sep 7, 2024, 4:36 PM Sep 7, 2024, 4:22 PM

    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
    • R
      rdipardo
      last edited by Sep 7, 2024, 7:44 PM

      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

      S 1 Reply Last reply Sep 7, 2024, 9:32 PM Reply Quote 5
      • S
        SinghRajenM moderator @rdipardo
        last edited by Sep 7, 2024, 9:32 PM

        @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.

        R 1 Reply Last reply Sep 7, 2024, 10:08 PM Reply Quote 1
        • R
          rdipardo @SinghRajenM
          last edited by Sep 7, 2024, 10:08 PM

          @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.

          S 1 Reply Last reply Sep 8, 2024, 5:39 AM Reply Quote 3
          • S
            SinghRajenM moderator @rdipardo
            last edited by Sep 8, 2024, 5:39 AM

            @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
            3 out of 5
            • First post
              3/5
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors