German noch mal Tutorial Bluetooth...

Stefan080159

Member
Licensed User
Longtime User
Guten Abend,
ich wollte das Tutorial von Erel für meine Bedürfnisse anpassen.
Dabei soll der eingehende String ausgewertet werden. Das funzt auch
soweit. Wenn eine bestimmte Zeichenfolge gefunden wird soll der String
mit AS als RichString farblich formatiert werden.
Aber Msg = RS funzt leider nicht weil scheinbar txtLog.Text = RS erwartet.
(siehe Code)


Code:
Sub Globals
    Private txtLog As EditText
    Private RS As RichString
End Sub

Code:
Sub LogMessage(From As String, Msg As String)
    RS.Initialize(Msg)
    If Msg.Contains("<->") Then
        RS.Color(Colors.Red,0,RS.Length)
    else If Msg.Contains("^") Then
        RS.Color(Colors.Green,0,RS.Length)
    End If
    Msg = RS
    txtLog.Text = txtLog.Text & RS & CRLF
    txtLog.SelectionStart = txtLog.Text.Length
End Sub

… kann da bitte geholfen werden?

Mit freundlichen Grüßen
Stefan
 
Das Problem ist scheinbar
Code:
txtLog-text = txtLog.text & CRLF
denn bei
Code:
txtLog.text = MSG
funzt es...

...aber keine Ahnung warum?
 
Ne, bei
Code:
txtLog.text = RS
funzt es.
Hat vielleicht jemand eine Idee, wie ich auch die folgenden Strings
auf txtLog bekomme ?
 
...hat sich erledigt
habe es jetzt so gemacht...
Code:
Sub LogMessage(From As String, Msg As String)
    Dim RSB As RichStringBuilder
    Dim RS As RichString
    RSB.Initialize
    RS.Initialize( Msg & CRLF)
    If Msg.Contains("AT") Then
        RS.color(Colors.Red,0,RS.Length)
    else If Msg.Contains("SO vor H/V") Then
        RS.Color(Colors.Yellow,0,RS.Length)
    else If Msg.Contains("GA vor H/V") Then
        RS.Color(Colors.Yellow,0,RS.Length)
    else If Msg.Contains("SO nach H/V") Then
        RS.Color(Colors.Green,0,RS.Length)
    else If Msg.Contains("GA nach H/V") Then
        RS.Color(Colors.Green,0,RS.Length)
    End If
    RSB.Append(RS)
    txtLog.Text = RSB
    txtLog.SelectionStart = txtLog.Text.Length
End Sub

Grüße
 
Back
Top