We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

FindRange with search up option

I can't seem to make FindRange search up.

I am using FindRange with a regexp to first find a specific block of text:

// Search from the top to bottom looking for "NAME:func1"
CoordinatePoint stpt = this.Editor.ConvertVirtualPointToCoordinatePoint(1,1);
ITextRange range = this.Editor.FindRange("\bNAME\b.*\bfunc1\b", stpt, null, true, true, false, true);

I then want to start from the point found and search backwards (up) to find another string:


CoordinatePoint pt = this.Editor.ConvertVirtualPointToCoordinatePoint(range.Start.PhysicalPoint.Position, range.Start.PhysicalPoint.Line);
this.Editor.FindRange("\bBEGIN_DEFINITION\b", pt, stpt, true, true, true, true);

The range returned by the second call is always null. The following text is that is in the Edit Control


#BEGIN_DEFINITION
#NAME:func1
#TYPE:codeblock
#
# BEGIN_COMMENT
#
# END_COMMENT
#
#END_DEFINITION

2 Replies

CT Craig Timmerman May 4, 2007 09:57 PM UTC

I forgot to mention, this is Syncfusion 4.2.0.37


AD Administrator Syncfusion Team May 10, 2007 09:15 PM UTC

Hi Craig,

It is possible to search up using the FindRange method. I have attached a sample that illustrates this. Let me know if this meets your requirements.

Thank you for your patience.

Regards,
Ebenezer.P

http://websamples.syncfusion.com/samples/Edit/60455/main.htm

Loader.
Live Chat Icon For mobile
Up arrow icon