Sub Process_Globals
End Sub
Sub Globals
Dim ClickableLabel As Label
Dim LogLabel As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
' note that the SetClickableText method parses the String as HTML
' so if you try to use the CRLF constant in this String it will not create a new line
' instead the HTML <br> element can be used
Dim HtmlString As String="<u>Any</u> text that you want to detect clicks on must be within an HTML <u>UNDERLINE</u> element, the UnderlineSpanClick event is passed SelectionStart and SelectionEnd parameters.<br>Click <u>HERE</u> to continue."
Dim LabelExtras1 As LabelExtras
LabelExtras1.SetClickableText(ClickableLabel, HtmlString, "ClickableLabel")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub ClickableLabel_UnderlineSpanClick(SelectionStart As Int, SelectionEnd As Int)
Dim LogText As StringBuilder
LogText.Initialize
LogText.Append("ClickableLabel_UnderlineSpanClick: "&DateTime.Now&CRLF)
LogText.Append("SelectionStar="&SelectionStart&CRLF)
LogText.Append("SelectionEnd="&SelectionEnd&CRLF)
Dim ClickedText As String=GetClickedText(SelectionStart, SelectionEnd)
LogText.Append("Clicked text='"&ClickedText&"'")
LogLabel.Text=LogText.ToString
If ClickedText="HERE" Then
StartActivity(ActivityTwo)
End If
End Sub
Sub GetClickedText(SelectionStart As Int, SelectionEnd As Int) As String
Dim LabelText As String=ClickableLabel.Text
Log("LabelText="&LabelText)
Dim ClickedText As String
' i've put this code in a Try/catch block as i was getting an occasional exception with an invalid range
' will need to be debugged...
Try
ClickedText=LabelText.SubString2(SelectionStart, SelectionEnd)
Catch
ClickedText=LastException
End Try
Return ClickedText
End Sub