-
Hyperlink in RTB
I am trying to detect Hyperlinks in RTB in rtb_chage event. That gets trigerred whenever we type single letter. This becomes problematic when the text is large. The time taken for the typed letter appearing in the screen, is more delayed as the size becomes larger.
The logic I use is,
1. In the rtb_change event get all the text from rtb
2. search in the text for "http:"
3. if found add the color and underline.
The first two steps are done for every letter I type. This is good if I just paste some data from outside but does not look good for typing.
Any suggestion?better logic? any good function?
-
Why don't you have it look 100-200 characters back from the current caret position instead?
That would eliminate the problem of grabbing all text from the RTB.
-
Thanks for your time in replying me.
That sounds one of the good ideas! Again, I'll have problem if a user just pastes a large text from some where with links. The text above 100-200 gets ignored.
Also, I was thinking to get the index of the first visible line in the RTB, again I'll end up in the same problem, where the link in the text above is ignored if pasted.
-
See my submission on planetsourcecode.
-
Thank you so much. That really look much better.
Still I am struggling to get what I want.
Is it possible to set this property (autodetect URL) to an existing Richtextbox?
I have already a RTB (Richtxt32.ocx) in place and I just want to set this property
to that.
SendMessage rtbMsgBody.hwnd, EM_SETEVENTMASK, 0, ByVal ENM_LINK
Call SendMessage(rtbMsgBody.hwnd, EM_AUTOURLDETECT, 1, ByVal 0)
and having everything else in place. The link does not turn into blue and
clicking also not effective.
Is it possible to do so or am I doing something wrong?
-
Try this..
replace hwndRichEdit.... with
hwndRichEdit = MyRichtextbox.hwnd
I try also this code and find out that when click hyperlink, browser does not open new window??
Anyboy know whats this problem?
I use IExplorer 6.x
-
oops...Sorry i find out whats the probelm...
"
Great Code ...! But, You forgot on the
Module as following ...
Public Const WM_LBUTTONUP = &H202
"
It works fine now! Creat code!!
Is it possible activate email addresses without "mailto:" keywords? eg. if user write [email protected] to the RTB then address automatically was activated??