I can't figure out how to change the background color of a range of text. I've tried and tried and tried and tried and tried and it just does not work at all. Could somebody give me an example of how to do this or if it's not possible just tell me.
  I really need a response.

While it sounds like you are having a rough time, it would help if you gave some context... what approaches have you tried, what *did* happen even if they didn't work the way you want, etc.

As it happens, I can see that you made a "Scintilla Feature Request" that is presumably talking about this too.

Anyway, offhand (and assuming you are not writing or working with a lexer), the way I would do this would be pretty much like setting up Scintilla to work with a lexer: define the display and font attributes of a style or styles using SCI_STYLESETFORE, SCI_STYLESETBACK, SCI_STYLESETBOLD, etc. Then just do a SCI_STARTSTYLING followed by some number of SCI_SETSTYLING calls using "styles" you have defined above.

I have not tried doing "raw" use of the styling machinery like this, but this is about what it should look like. A refinement if you are going to define more than a couple of styles would be to define "common" attributes for the "magic" STYLE_DEFAULT, and then do a SCI_STYLECLEARALL to set all styles to these values - then use the "SCI_STYLESET*" calls to set the differences.

Robert Roessler
[EMAIL PROTECTED]
http://www.rftp.com


I forgot to set it so I receive the e-mails, so I didn't see the response till I visited the site - so that's why this is in a new thread.

So I was trying to figure out how to change the background color of a range of text in a scintilla text control - namely the wxStyledTextCtrl for wxWidgets. I'm making a Bible program and I want to highlight specified verses.

Today I tried the following:

StyleSetBackground(0, wxColour(255, 255, 0);
StartStyling(10, 0);
SetStyling(5, 0);

to style 5 characters starting at position 10 in yellow. However, all text became yellow (but the background of the control stayed white).

I also tried using SCI_STYLESETBACK directly with no luck.

I even tried defining my own styles using style indexes above and below 32:

StyleSetBackground(5, wxColour(255, 255, 0);
StartStyling(10, 0);
SetStyling(5, 5);

and

StyleSetBackground(100, wxColour(255, 255, 0);
StartStyling(10, 0);
SetStyling(5, 100);

to no avail. It just does not work. I'm lost and I really want this to work - if I can't get this to work I basically have to scrap my application - http://aletheia.sourceforge.net. Can you give me some example code please? I'll try what Robert suggested in the meantime.


_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to