set background on a scintilla control?

101 views
Skip to first unread message

EntropyReduction

unread,
Nov 26, 2007, 1:01:16 PM11/26/07
to scintilla-interest, scintilla...@alancampbelllists.fsnet.co.uk
Is there any way to set the background of a scintilla control,
equivalent of
EM_SETBKGNDCOLOR for edit boxes? SCI_STYLESETBACK won;t do the trick,
that will at best only affect areas of a control filled with text, or
so I read.

Neil Hodgson

unread,
Nov 26, 2007, 5:33:24 PM11/26/07
to scintilla...@googlegroups.com
EntropyReduction:

You set default attributes for all styles by changing STYLE_DEFAULT
then calling SCI_STYLECLEARALL.

Neil

Erik

unread,
Nov 26, 2007, 5:33:25 PM11/26/07
to scintilla-interest
On Nov 26, 6:01 pm, EntropyReduction <EntropyReduct...@gmail.com>
wrote:
Try calling SCI_STYLESETBACK for STYLE_DEFAULT (which is 32). You
problably want to call SCI_STYLECLEARALL after that, to copy that
background color to all styles.

Erik

unread,
Nov 26, 2007, 5:43:41 PM11/26/07
to scintilla-interest
> You set default attributes for all styles by changing STYLE_DEFAULT
> then calling SCI_STYLECLEARALL.
>
> Neil

Damn, you were a couple of seconds faster than me =)

EntropyReduction

unread,
Nov 27, 2007, 12:37:47 PM11/27/07
to scintilla-interest


> > Is there any way to set the background of a scintilla control,
> > equivalent of
> > EM_SETBKGNDCOLOR for edit boxes? SCI_STYLESETBACK won;t do the trick,
> > that will at best only affect areas of a control filled with text, or
> > so I read.
>
> Try calling SCI_STYLESETBACK for STYLE_DEFAULT (which is 32). You
> problably want to call SCI_STYLECLEARALL after that, to copy that
> background color to all styles.

In the environment I'm coding (a plugin used by powerpro scripting
language users)
I can't safely call SCI_STYLECLEARALL (because users may have set
styles in a running script, and
only want to change background of the scintilla control, not all the
other characteristics of styles.

So, sure, I can call SCI_STYLESETBACK on styles 0 through STYLE_MAX.
That doesn't seem to do the trick in an empty scintilla control (with
no text displayed). Should it? My reading of SCI_STYLESETBACK is
that it changed properties of text having that style, not of the whole
of the background of an eidt box.

Neil Hodgson

unread,
Nov 27, 2007, 7:52:48 PM11/27/07
to scintilla...@googlegroups.com
EntropyReduction:

> So, sure, I can call SCI_STYLESETBACK on styles 0 through STYLE_MAX.
> That doesn't seem to do the trick in an empty scintilla control (with
> no text displayed). Should it?

Yes.

> My reading of SCI_STYLESETBACK is
> that it changed properties of text having that style, not of the whole
> of the background of an eidt box.

All elements of the client area are drawn with numbered styles
although this may be modified by other features such as the cart line
and markers.

Neil

EntropyReduction

unread,
Nov 29, 2007, 12:36:13 PM11/29/07
to scintilla-interest
Hi Neil,
On Nov 28, 12:52 am, "Neil Hodgson" <nyamaton...@gmail.com> wrote:

> > So, sure, I can call SCI_STYLESETBACK on styles 0 through STYLE_MAX.
> > That doesn't seem to do the trick in an empty scintilla control (with
> > no text displayed). Should it?
>
> Yes.

Oh, how embarrassing. I did:

if (rgbBack != rgbBackOld && !COLOUR_NONE(rgbBack));
{
for (int i = 0; i <= STYLE_MAX; i++)
{SendMessage(m_hwnd, SCI_STYLESETBACK, i, rgbBack);}
}

which didn't do alot til I spotted the spare semicolon.

Works fine now. Sorry to waste your time.



Reply all
Reply to author
Forward
0 new messages