Results 1 to 7 of 7

Thread: Hyperlink in RTB

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Posts
    3

    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?

  2. #2
    Lively Member The Hand's Avatar
    Join Date
    Jun 2001
    Posts
    88

    Post

    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.
    Visit EliteVB for slimy subclassing tricks and GDI32 goodness.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Posts
    3
    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.

  4. #4
    Megatron
    Guest
    See my submission on planetsourcecode.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Posts
    3
    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?

  6. #6
    New Member
    Join Date
    Jul 2002
    Posts
    8
    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

  7. #7
    New Member
    Join Date
    Jul 2002
    Posts
    8
    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??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width