Community
    • Login

    Calltip on mouse-over from UDL xml file (Python)

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    21 Posts 5 Posters 1.7k 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.
    • Lycan ThropeL
      Lycan Thrope @Khundian Twitch
      last edited by

      @Khundian-Twitch ,
      Just a note, and I’m not sure if this is relevant with what you’re doing with pythonscript, but the calltip functions are triggered by a delimiter insertion, meaning when you type the keyword, and then click a parens if it is the opening for a function, then the calltip pops up, and you have to use the mouse to click the buttons up or down.

      What you’re doing, may not make what I just mentioned relevant, since it sounds like you’re past my knowledge, but I thought I might mention in in case it is relevant.

      1 Reply Last reply Reply Quote 2
      • mpheathM
        mpheath @Khundian Twitch
        last edited by mpheath

        @Khundian-Twitch said in Calltip on mouse-over from UDL xml file (Python):

        I did a small test with the SCINTILLANOTIFICATION.CALLTIPCLICK and this was the result, position 0 is clicked anywhere but the arrows, position 1 is clicked on the up arrow and position 2 should be clicked on the down arrow… but this results in Notepad++ crashing to desktop.

        Exits with

        Exception Code: c0000094

        which is a division by zero code. Seems the position key cannot return a value 2 as it fails to get a value.

        Also a second error

        Exception Code: c000041d

        A STATUS_FATAL_USER_CALLBACK_EXCEPTION code.

        This is what I tested with:

        from Npp import console, editor, notepad, SCINTILLANOTIFICATION
        
        try:
            callback_registry
        except:
            callback_registry = []
        
        calltip_wrap = ['\x01 one\n\x02 description', '\x01 two\n\x02 description']
        
        if not editor.callTipActive():
            editor.callTipShow(editor.getCurrentPos(), calltip_wrap[0])
        
        def calltip_update(args):
            console.write(args)
            pos = editor.getCurrentPos()
        
            if editor.callTipActive():
                if args['position'] == 2:
                    editor.callTipCancel()
                    editor.callTipShow(pos, calltip_wrap[0])
                elif args['position'] == 1:
                    editor.callTipCancel()
                    editor.callTipShow(pos, calltip_wrap[1])
        
            return True
        
        if 'calltip_update' not in callback_registry:
            callback_registry.append('calltip_update')
            editor.callback(calltip_update, [SCINTILLANOTIFICATION.CALLTIPCLICK])
        
        Khundian TwitchK 1 Reply Last reply Reply Quote 2
        • Khundian TwitchK
          Khundian Twitch @mpheath
          last edited by

          @mpheath Thanks for taking the time to test, reply and clarify the issue.
          I guess I’m out of luck. I wonder if it’s something with the PythonScript plugin, when I have some time I’m gonna test with the LuaScript plugin and see if the same happens when creating a calltip.

          1 Reply Last reply Reply Quote 0
          • Khundian TwitchK
            Khundian Twitch
            last edited by

            I tested with the LuaScript plugin and exactly the same happens, I guess it has nothing to do with either Python or LUA plugin. I guess its a bug in Scintilla or Notepad++. I’ll post the LUA code I used to test below.

            function showcalltip(ch)
            	calltip = "\001 <Click> \002"
            	pos = editor.CurrentPos
            	editor:CallTipShow(pos, calltip)
                return false
            end
            
            function printclick(flag)
                print(flag)
                return false
            end
            
            print("Test script running.")
             
            npp.AddEventHandler("OnChar", showcalltip)
            npp.AddEventHandler("OnCallTipClick", printclick)
            
            Alan KilbornA 1 Reply Last reply Reply Quote 1
            • Alan KilbornA
              Alan Kilborn @Khundian Twitch
              last edited by

              @Khundian-Twitch said in Calltip on mouse-over from UDL xml file (Python):

              I guess its a bug in Scintilla or Notepad++

              A crash is a pretty big deal; someone should open an official bug report on github.

              Khundian TwitchK 1 Reply Last reply Reply Quote 2
              • Khundian TwitchK
                Khundian Twitch @Alan Kilborn
                last edited by Khundian Twitch

                @Alan-Kilborn said in Calltip on mouse-over from UDL xml file (Python):

                @Khundian-Twitch said in Calltip on mouse-over from UDL xml file (Python):

                I guess its a bug in Scintilla or Notepad++

                A crash is a pretty big deal; someone should open an official bug report on github.

                I agree, but I’m not sure if this qualifies as a bug in Notepad++?
                The standard implementation of using the arrows to cycle through multiple overloads works fine. Its only when a user starts tinkering with script plugins and creating their own calltips that this crash will occur.

                1 Reply Last reply Reply Quote 1
                • Khundian TwitchK
                  Khundian Twitch
                  last edited by

                  I created a bug report on github, guess we’ll see if it qualifies as a bug. Link to report

                  1 Reply Last reply Reply Quote 3
                  • Khundian TwitchK
                    Khundian Twitch
                    last edited by

                    @mpheath Seems it was something in the Notepad++ code, but solved very quickly by the guys on github. Without a doubt the debug info you provided had something to do with that, Thanks again! :)

                    mpheathM 1 Reply Last reply Reply Quote 2
                    • mpheathM
                      mpheath @Khundian Twitch
                      last edited by mpheath

                      @Khundian-Twitch Well done! I tested the artifact in PR #14667 that solves the crash issue and so now position 2 is possible for the down arrow of the calltip.

                      1 Reply Last reply Reply Quote 3
                      • Khundian TwitchK
                        Khundian Twitch
                        last edited by

                        I have finished the script, if anyone is interested I posted it in the Plugin development forum.
                        Thanks again to everyone who helped me out!

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