Community
    • Login

    PythonScript and Customize Toolbar Question

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    9 Posts 2 Posters 749 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.
    • John Doe 1J
      John Doe 1
      last edited by

      Hey there everyone, I’ve got a toggleable Python script working properly now (I inquired in my last post about it but that issue is now solved) that I am using in conjunction with Customize Toolbar for toolbar button functionality. I’ve got my button set up and it is working as expected but I was wondering if it is possible/not-a-ton-of-work to get that button to change appearance when it is toggled on so that the user can look and see that it is indeed on without having to remember if they toggled it on earlier. Anyone have any idea of how to accomplish this? Any help is greatly appreciated!

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @John Doe 1
        last edited by

        @john-doe-1

        I use the Customize Toolbar plugin myself for some PythonScripts but I do not believe what you are desiring is possible. You might be better off with a script that will toggle your functionality on/off and, when toggled, outputs something indicating the current state setting to the status bar (or to a message box, but that is more intrusive).

        John Doe 1J 1 Reply Last reply Reply Quote 0
        • John Doe 1J
          John Doe 1 @Alan Kilborn
          last edited by

          @alan-kilborn Thanks for letting me know, any idea for using that Statusbar to accomplish this without messing with the important information it shows?

          “Notepad.setStatusBar(statusBarSection, text)
          Sets the status bar text. For statusBarSection, use one of the STATUSBARSECTION constants.”

          The issue is that all of the status bar sections are useful/important to me.

          Alan KilbornA 1 Reply Last reply Reply Quote 0
          • Alan KilbornA
            Alan Kilborn @John Doe 1
            last edited by

            @john-doe-1 said in PythonScript and Customize Toolbar Question:

            The issue is that all of the status bar sections are useful/important to me.

            The leftmost section is not that important – I suppose that can be debated but IMO I’m not going to lose that debate.

            Outputting something there for a script is temporary, anyway.
            If you switch tabs and then switch back, Notepad++ will show you what was originally there again.

            John Doe 1J 2 Replies Last reply Reply Quote 3
            • John Doe 1J
              John Doe 1 @Alan Kilborn
              last edited by

              @alan-kilborn Yeah I suppose so, I might go ahead with this, thanks!

              1 Reply Last reply Reply Quote 0
              • John Doe 1J
                John Doe 1 @Alan Kilborn
                last edited by

                @alan-kilborn So I ended up going ahead with your suggestion. Question, after I toggle off Column Mode that text in the status bar is “Column Mode On” I would like to be able to revert that to what it originally said (the type of file) is there a way I can read in the leftmost part of the status bar before changing it so I can revert it back to the original?

                Alan KilbornA 1 Reply Last reply Reply Quote 0
                • Alan KilbornA
                  Alan Kilborn @John Doe 1
                  last edited by Alan Kilborn

                  @john-doe-1 said in PythonScript and Customize Toolbar Question:

                  is there a way I can read in the leftmost part of the status bar before changing it so I can revert it back to the original?

                  Yes, but it is not a single function call, and is it really worth it?
                  The file type is easily figured out by context of information in the editor, and/or the extension of the file (shown on the tab). Plus, as mentioned, if you switch tabs and switch back, Notepad++ will restore that section of the status bar, if you REALLY think you have to see this.

                  Ok, I can’t convince you… so there’s some code HERE that will help you see how to capture the current contents of a section of the status bar.

                  John Doe 1J 1 Reply Last reply Reply Quote 2
                  • John Doe 1J
                    John Doe 1 @Alan Kilborn
                    last edited by John Doe 1

                    @alan-kilborn Okay you may have convinced me that it is more trouble than it’s worth considering it includes additional libraries. One of the last things of this Script that needs cleaning up is a way to release the “Alt” key when the user tabs out of (or closes) Notepad++. Currently if the user does not turn off Column Mode before closing Notepad++ the “Alt” key remains pressed, this is of course a bit of an issue. If you know of a way to detect when Notepad++ is tabbed out of or closed I would appreciate your help.

                    Alan KilbornA 1 Reply Last reply Reply Quote 0
                    • Alan KilbornA
                      Alan Kilborn @John Doe 1
                      last edited by

                      @john-doe-1 said in PythonScript and Customize Toolbar Question:

                      if the user does not turn off Column Mode before closing Notepad++ the “Alt” key remains pressed, this is of course a bit of an issue. If you know of a way to detect when Notepad++ is tabbed out of or closed I would appreciate your help.

                      This is bringing the discussion back to the other script you hinted at in your first posting in this thread. See HERE for that other thread, and some ideas about the “Alt” key.

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