wxStyledTextCtrl Indicators

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2293
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

wxStyledTextCtrl Indicators

Post by evstevemd » Wed Apr 17, 2013 6:59 pm

Hi,
I'm trying to highlight similar text in my editor and I use indicators. The problem is the text is underlined than being surrounded by a box.
I need to do something nicer (a box around text or highlight with color) than a colored line.

Here is my relevant code and below is the shot.

Code: Select all

IndicatorSetForeground(wxSTC_INDIC_ROUNDBOX, *wxRED);
SetIndicatorCurrent(wxSTC_INDIC_ROUNDBOX);
IndicatorFillRange(posFound, GetTargetEnd() - posFound);
problem.png
problem.png (69.2 KiB) Viewed 1068 times
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 19.04/Windows 10 Pro/MacOS 10.13 - GCC/MinGW/Clang, CodeLite IDE]

eranif
Moderator
Moderator
Posts: 607
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Re: wxStyledTextCtrl Indicators

Post by eranif » Thu Apr 18, 2013 6:20 am

Hi!
You need to set the indicator number and use it, wxSTC_INDIC_ROUNDBOX is a style

For example, in codelite I have this code:

Code: Select all

// somewhere at the top of the file
#define MATCH_INDICATOR 10

//...
IndicatorSetUnder(MATCH_INDICATOR, true);
IndicatorSetStyle(MATCH_INDICATOR, wxSTC_INDIC_ROUNDBOX);

// When there is a match:
SetIndicatorCurrent(MATCH_INDICATOR);
IndicatorFillRange(...);
Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org

User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2293
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Re: wxStyledTextCtrl Indicators

Post by evstevemd » Thu Apr 18, 2013 10:07 am

eranif wrote:Hi!
You need to set the indicator number and use it, wxSTC_INDIC_ROUNDBOX is a style

For example, in codelite I have this code:

Code: Select all

// somewhere at the top of the file
#define MATCH_INDICATOR 10

//...
IndicatorSetUnder(MATCH_INDICATOR, true);
IndicatorSetStyle(MATCH_INDICATOR, wxSTC_INDIC_ROUNDBOX);

// When there is a match:
SetIndicatorCurrent(MATCH_INDICATOR);
IndicatorFillRange(...);
Eran
You are maverick!
It works nicely...thank you! =D>
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 19.04/Windows 10 Pro/MacOS 10.13 - GCC/MinGW/Clang, CodeLite IDE]

Post Reply