This is a migrated thread and some comments may be shown as answers.

Hyperlinks

8 Answers 119 Views
RichTextBox (obsolete as of Q3 2014 SP1)
This is a migrated thread and some comments may be shown as answers.
GM
Top achievements
Rank 1
GM asked on 18 Jul 2011, 09:56 PM
Is it possible to add hyperlinks to the RichTextBox and if so, is it possible to "catch" those links so that if a person for example clicks on a particular link you can programmatically call a procedure.

(I normally do this with the Microsoft Browser Control)

8 Answers, 1 is accepted

Sort by
0
Svett
Telerik team
answered on 21 Jul 2011, 08:27 AM
Hi Gm,

Thank you for your feedback.

We will implement the hyperlink support in the upcoming service pack. I added your suggestion to our public issue tracking system as a feature request.

All the best,
Svett
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
GM
Top achievements
Rank 1
answered on 11 Dec 2011, 10:59 PM
I have revisited this control with your new release (Q3 2011).

Seems that the hyperlink feature is now implemented - most welcome.

However, I picked up the following possible bugs:
1 -    RadRichTextBox1.HyperlinkNavigationMode - setting it to click in either design mode or through runtime code does not work - have to use Ctrl Click to navigate the hyperlink

2 - RadRichTextBox1.HyperlinkToolTipFormatString - cannot be set at design time - need to set it via code.

3 - Seems that the following code is not executed when the hyperlink is clicked (ctrl clicked):
Private Sub RadRichTextBox1_HyperlinkClicked(sender As Object, e As Telerik.WinControls.RichTextBox.Model.HyperlinkClickedEventArgs) Handles RadRichTextBox1.HyperlinkClicked
    MsgBox("YOU CLICKED A HYPERLINK")
End Sub

Input is most welcome on this.


0
Svett
Telerik team
answered on 14 Dec 2011, 01:57 PM
Hello Gm,

I managed to set the HyperlinkNavigationMode and HyperlinkToolTipFormatString properties of the RadRichTextBox control. The navigation mode property does not change the hyper link behavior. This issue will be addressed for the upcoming service pack. I did not manage to reproduce the HyperlinkClicked event issue. What did I miss? Could you share more details about your scenario and how to reproduce it?

Notice that I am using the latest release Q3 2011 (2011.3 11.1116).

I updated your Telerik points.

Regards,
Svett
the Telerik team

Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

0
GM
Top achievements
Rank 1
answered on 14 Dec 2011, 10:38 PM
Many thanks for yourkind reply.

Further to the Hyperlink clicked event issue:

If you click (or ctrl click) a hyperlink what the RadRichTextBox does is open the link in a new external web-browser.

My issue is this: my hyperlink must display a message box something to the following:
ie. When the hyperlink is clicked: msgbox ("You clicked " & hyperlink)  - [hyperlink is the link that was clicked]. A web browser must not open up.

I successfully implemented this using a standard web browser control using the following code:
Private Sub WebBrowser1_Navigating(sender As Object, e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles WebBrowser1.Navigating

    If e.Url.ToString() <> "about:blank" Then
        e.Cancel = True
    End If
 
    Dim MESSAGETEXT As String = ""
    MESSAGETEXT= e.Url.ToString.Remove(0, 6)
    MsgBox(MESSAGETEXT)

End
Sub

Can anything close to this be achieved with the RadRichTextBox control.

The possibilities are endless if one replaces the MsgBox line with some custom code - this is where coding gets interesting.


Looking forward to your answer.
0
sameer
Top achievements
Rank 1
answered on 15 Dec 2011, 08:20 AM
hey Gm ,
did u got the solution for hyperlinked event, even m also not getting that event fired.........
please let me know ASAP, it will greatful.
thanks 
0
Svett
Telerik team
answered on 19 Dec 2011, 12:39 PM
Hello guys,

@Gm:

Presently, the HyperlinkedClicked event is fired only in HyperlinkNavigationMode.CtrlClick mode. This issue is related to the HyperNavigationMode issue that I have mentioned earlier. You can show in MessageBox the clicked URL by using the following code snippet:

Private Sub radRichTextBox1_HyperlinkClicked(sender As Object, e As HyperlinkClickedEventArgs)
    MessageBox.Show(e.URL)
End Sub

@Sameer: I am glad to inform you that the issue has already been addressed for the upcoming service pack which will be published this week.

Regards,
Svett
the Telerik team

Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

0
GM
Top achievements
Rank 1
answered on 19 Dec 2011, 03:09 PM
Many thanks for your reply.  

Tried with the Ctrl Click -
the event is still not fired.

Tried with Click - even still not fired (as expected)


Svett - It seems you have it working with Ctrl Click for now. Can you please include a small sample project so that I can see where I am going wrong as you seem to have it working with Ctrl Click.

Looking forward to your reply.


0
Accepted
Prijesh
Top achievements
Rank 1
answered on 21 Dec 2011, 02:06 PM
hey GM,
I found the way to fire that event after trying many ways 
first of all you have to add handler to the hyperlink clicked event

AddHandler RadRichTextBox1.HyperlinkClicked, AddressOf hyperlinkclick


now you write your code in hyperlinkclick procedure

Public Sub hyperlinkclick(ByVal sender As Object, ByVal e As Telerik.WinControls.RichTextBox.Model.HyperlinkClickedEventArgs) Handles RadRichTextBox1.HyperlinkClicked
        Try
            e.Handled = True
          ''Write your code that you want
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub


this is working for me, hope you find it helpful

Tags
RichTextBox (obsolete as of Q3 2014 SP1)
Asked by
GM
Top achievements
Rank 1
Answers by
Svett
Telerik team
GM
Top achievements
Rank 1
sameer
Top achievements
Rank 1
Prijesh
Top achievements
Rank 1
Share this question
or