Change Autocomplete background color



  • I do not see a nice SCI_AUTOC* message to change the autocomplete window background color from the standard white (with black text):

    b1cfb704-a83e-4bf8-90c0-19dd15deffdb-image.png

    I thought it may be using one of the Scintilla STYLES but I can’t find which one (if so). The simple answer may be “no, it can’t be done”, but I’ve seen some magic on this form with ctypes and Win32 API and PythonScript and thought maybe there is a way to change it.

    Any ideas?

    Cheers.



  • Hello,@Michael-Vincent
    Please follow this information, To Change Autocomplete background color

    Thus we need to send the SCI_CALLTIPUSESTYLE message and (continue reading on the website) we can configure foreground and background color with SCI_CALLTIPSETBACK and SCI_CALLTIPSETFORE.

    So to set the color of the call tip by sending messages to the Scintilla editor component using NppExec, you need do this:

    install NppExec with the PluginManager or from PluginCentral. The NppExec zip file contains the dll and some subdirectories. When installing/upgrading into Notepad++ plugin directory, take care that the subdirectories NppExec is created under the plugins directory. The NppExec directory contains the file Scintilla.h which has all the definitions for the possible messages.

    store these lines as a NppExec script (Plugins -> NppExec -> Execute… , enter the following lines and select save, e.g. as SetCallTipStlye):

    // use CALLTIPSTYLE instead DEFAULT
    SCI_SENDMSG SCI_CALLTIPUSESTYLE 0
    // background to black ( 0 )
    SCI_SENDMSG SCI_CALLTIPSETBACK 0
    // foreground to white ( 0xffffff )
    SCI_SENDMSG SCI_CALLTIPSETFORE 0xffffff
    

    execute the script with OK

    Now your calltip Window should be white on black, you might want to adopt the colors by changing the arguments.

    If everything works as you expect, then Plugins -> NppExec -> Advanced Options offers the option Execute this script when Notepad++ starts on the upper right area of the config dialog. Select the script name under which you saved the line

    I hope this information will be useful to you.
    Thank you.



  • @prahladmifour said in Change Autocomplete background color:

    SCI_CALLTIPUSESTYLE message and (continue reading on the website) we can configure foreground and background color with SCI_CALLTIPSETBACK and SCI_CALLTIPSETFORE

    I’m familiar with these messages and already use PythonScript to change the background of calltips, but that is not what I’m asking. I’m asking about Autocomplete.

    Cheers.



  • @Michael-Vincent

    afaik, “no, it can’t be done” :-) at least not from within scintilla
    A really dirty hack would be to change the colors system wide like this

    4c670ed3-6670-4132-8be8-79516d62a39e-image.png

    and maybe using focusin and focusout event for setting and resetting it.

    One other way might be to subclass scintillas window procedure
    and react on wm_paint messages. Hmm, now I remember that
    there is also a scintilla notification called painted.
    Maybe this can be used as well.
    Sorry, currently very busy with other stuff but maybe I can find some time
    tomorrow and see if this can be achieved using ctypes and python.



  • @Ekopalypse

    Yeah, hoping to not change the system colors, just do it within Scintilla. If it can’t be done - that’s a valid answer - no need to pursue any further. Your script above - that’s not Python … is it?

    I did a bit of exploring, looks like the Notepad++ WindowClass for the autocomplete window is ListBoxX:

    7a768056-810b-4a32-995a-0d23c804ca93-image.png

    Cheers.



  • @Michael-Vincent

    Yes, UI Spy reports the same ListboxX. Maybe a custom window
    scintilla created. Hmmm … that could mean that there is a wm_paint event.
    No, it is not python.
    I’m currently trying different new programming languages.
    The above one is V.
    Is nice - I see a lot of potential but is still in alpha stage at the moment.



  • @Michael-Vincent

    I have already tried - I don’t see how this can be realized in a reasonable way.
    The ListBox is NOT a child window of Scintilla, so I am not able to see
    when this control is created by subclassing scintilla.
    And as a top level window I can only find it after it has been created.
    When subclassed, it did not provide WM_PAINT messages.
    I can’t think of anything else to try at the moment.



  • @Ekopalypse said in Change Autocomplete background color:

    I have already tried - I don’t see how this can be realized in a reasonable way.

    No worries - thanks for trying. I know we can access some N++ windows like the splitter to move / rotate the Scintilla views so thought this might be similar, but I couldn’t get anywhere (which isn’t saying much). If experienced Python scripters like yourself can’t do it reasonably, I tend to think it can’t be done.

    Again, thanks for trying - please don’t waste anymore time on it for me.

    Cheers.



  • @Michael-Vincent

    I tend to believe that there is a solution for every problem.
    Unfortunately I have not yet come up with one. :-D


Log in to reply