Page 1 of 1

Selection bounds and Unicode text

Posted: Tue Jan 15, 2008 1:45 pm
by martindholmes
Hi there,

I'm trying to implement a "Find All" function which creates a list of all the hits from a particular search operation, using SearchTextW. I'm able to find each instance of the search text without problems, but I'm having trouble storing information about the hit (start location, length, and a "hit in context" string that I generate with GetTextRange). The obvious way to do this is to use RVLinear functions, but they all work with strings, not WideStrings. So I have a couple of questions:

1. Is there any plan to provide a WideString version of RVLinear.pas? I see you've created RVGetTextW.pas already; a version of RVLinearW.pas would be really handy.

2. If not, is there any way to store the details of the search hit? My problem here is that the document may contain tables, so I not only need to know the item number and offset, but also the RVData that contains the item.

3. Is there a simpler way to do this?

All help appreciated,
Martin

Posted: Tue Jan 15, 2008 3:37 pm
by Sergey Tkachenko
Sorry, but if you create a list of SearchTextW results, I think you know what text is found.

Posted: Tue Jan 15, 2008 4:53 pm
by martindholmes
I know what text was found, but I don't know where it was found (in what RVData).

I suppose I'll have to create a linear list of all the items in all the RVDatas, and do the search inside each item.

Cheers,
Martin

Posted: Wed Jan 16, 2008 6:09 pm
by Sergey Tkachenko
You can use RVGetSelection and RVSetSelection from RVLinear.pas to store/restore the selection. They work if document has Unicode text.