Board index » cppbuilder » TRichEdit selection + wrap property

TRichEdit selection + wrap property

I have one problem

I want to find some word in TRichEdit (i am doing that going throught
AnsiString RichEdit->Lines->Text .. - my own function..) When wrap == false
.. everything is OK..

but when wrap == true position in Text property is not the same as position
on the form ..

any ideas  what to do ..?
----
D r e n i k   N e t w o r k s  /  Y u g o s l a v i a

Predrag R. Jovanovic
FTP Administrator, HTML
home page:  http://download.drenik.net
email: pjs...@drenik.net

 

Re:TRichEdit selection + wrap property


Why not simply use TRichEdit's built-in searching capabilities?  TRichEdit
has a FindText() method.

Gambit

Predrag R. Jovanovic <pjs...@drenik.net> wrote in message
news:3b1e4df3_2@dnews...

Quote
> I want to find some word in TRichEdit (i am doing that going throught
> AnsiString RichEdit->Lines->Text .. - my own function..) When wrap ==
false
> .. everything is OK..

> but when wrap == true position in Text property is not the same as
position
> on the form ..

Re:TRichEdit selection + wrap property


 I need to find and parse all text that begins with http:// and ends with
blanko character (<=32) -- all url addresses
----
D r e n i k   N e t w o r k s  /  Y u g o s l a v i a

Predrag R. Jovanovic
FTP Administrator, HTML
home page:  http://download.drenik.net
email: pjs...@drenik.net

Quote
Remy Lebeau <gambi...@gte.net> wrote in message news:3b1e55e5_2@dnews...
> Why not simply use TRichEdit's built-in searching capabilities?  TRichEdit
> has a FindText() method.

> Gambit

> Predrag R. Jovanovic <pjs...@drenik.net> wrote in message
> news:3b1e4df3_2@dnews...

> > I want to find some word in TRichEdit (i am doing that going throught
> > AnsiString RichEdit->Lines->Text .. - my own function..) When wrap ==
> false
> > .. everything is OK..

> > but when wrap == true position in Text property is not the same as
> position
> > on the form ..

Re:TRichEdit selection + wrap property


Predrag R. Jovanovic <pjsoft> wrote in message
news:3b1e4df3_2@dnews...

Quote
> I have one problem

> I want to find some word in TRichEdit (i am doing that going
throught
> AnsiString RichEdit->Lines->Text .. - my own function..) When wrap
== false
> .. everything is OK..

> but when wrap == true position in Text property is not the same as
position
> on the form ..

Just an idea, but Robert Dunn mentions using the EM_FINDWORDBREAK
message, although he doesn't show the actual parsing code.  If you
read about this message in the Win32API Help, it is quite
sophisticated, and may provide what you need.

--
Timothy H. Buchman
========================================
City Center Theater New York NY
tbuchmanPLEASE(at sign)REMOVEcitycenter.org
Please treat this signature information as confidential.
========================================
Search .borland newsgroup archives at:
http://www.mers.com/searchsite.html

Re:TRichEdit selection + wrap property


You can still use the FindText() method to find the starting positions of
the URLs.  From there, you can find the ending positions easily.  For
example:

TSearchTypes options = TSearchTypes() << stWholeWord;
AnsiString str = "http://";
int len = str.Length();

int startpos = RichEdit1->FindText(str, 0, RichEdit1->GetTextLen(),
options);
while(startpos != -1)
{
    int endpos = RichEdit1->Perform(WM_FINDWORDBREAK, WB_RIGHTBREAK,
startpos+len);

    // now you have the starting and ending positions for a URL,
    // do something with it

    // find the next URL
    startpos = RichEdit1->FindText("http://", endpos,
RichEdit1->GetTextLen()-endpos, options);

Quote
}

Gambit

"Predrag R. Jovanovic" <pjs...@drenik.net> wrote in message
news:3b1e66ea_2@dnews...

Quote
> I need to find and parse all text that begins with http:// and ends with
> blanko character (<=32) -- all url addresses

Other Threads