Console notifications

Ben Morgan
  • Ben Morgan

    Ben Morgan - 2012-05-01

    Basically for a couple of scripts I'm writing out results like the find results and it would be convenient to have folding for them (though it's not crucial)

    So I set up the styling and margin which worked and then tried to register a callback for SCINTILLANOTIFICATION.MARGINCLICK so I could do the toggle. It doesn't fire, and it looks like in
    void PythonHandler::notify(SCNotification *notifyCode)
    it exlicitly ignores them
    else if (notifyCode->nmhdr.hwndFrom != mp_console->getScintillaHwnd()) // ignore console notifications

    Would it be possible to get the console notifications sent through? Or possible to create your own consoles/log windows?

    If not, is there any way to remove console->callback so it doesn't give the impression of being able to have a callback?

  • Dave Brotherstone

    That's an interesting thought. Removing the console->callback would mean defining a new object, as it currently uses the same object definition as the standard "editor" interface, unless anyone knows any tricks to reduce an instance's members.

    It would be tricky to allow console->callback, not least because several callbacks must be handled by the plugin itself, the styling callbacks, the hotspot clicks and so on.

    Creating a new log/output window would be feasible, in a similar way to the console.  That would probably be the best solution, as I'd really like to make the console a bit neater eventually, so it works more like the python.exe prompt, but scintilla at the moment makes that a bit tricky - for instance, you can't say "read only until offset X, then read/write".

    I'll certainly bear in mind that extra log/output windows are wanted, as and when I have a crack at the next version. 
    You could also use a second N++ window - using editor1 for your main file and editor2 for logging could work too, if you're not already using 2 windows.


  • Ben Morgan

    Ben Morgan - 2012-05-03

    Well, if you had a base class for console/editor1/editor2, which editor inherited from and included callback and clearCallback etc. as well, that would work (adding new features to a base rather than taking them away).

    I don't want to use editor2 as some of the people I'm writing these scripts for do use split views.

    I think creating a new output log would be good. For the moment the console is fine - I style it but use the circle style rather than the plus/minus boxes style, and don't allow collapsing at all.

    As for a new console, if I remember correctly, wxPython's console uses scintilla and it handles allowing you to write at the console and still have the stuff above read-only. I don't know how it does it though (blocking char events maybe?).

    Thanks for your help,


Log in to post a comment.