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: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

wxStyledTextCtrl Indicators

Post by evstevemd »

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 1802 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?
eranif
Moderator
Moderator
Posts: 610
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Re: wxStyledTextCtrl Indicators

Post by eranif »

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: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: wxStyledTextCtrl Indicators

Post by evstevemd »

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?
Post Reply