Italian Messaggi con oltre 40 caratteri con B4I

toro1950

Active Member
Licensed User
Con b4i c'è un tipo di messaggio che supporta oltre 40 caratteri? con b4a ToastMessageShow supporta molti caratteri, praticamenete due linee
cono b4i hd.ToastMessageShow arriva a 40 caratteri, ho bisogno di inserire mesaggi con oltre 40 caratteri
 

Sagenut

Expert
Licensed User
Longtime User
Un Toast generalmente dura talmente poco che credo sia anche scomodo per leggere cose un pò lunghe.
Non sarebbe meglio fare una MsgBox?
 

Filippo

Expert
Licensed User
Longtime User
Con b4i c'è un tipo di messaggio che supporta oltre 40 caratteri? con b4a ToastMessageShow supporta molti caratteri, praticamenete due linee
cono b4i hd.ToastMessageShow arriva a 40 caratteri, ho bisogno di inserire mesaggi con oltre 40 caratteri
Devi usare questa procedura:
B4X:
Sub test1
    hd.ToastMessageShow("Tutto quello che vuoi scrivere e anche quello che non vuoi.", True)
    SetHudMultiline
End Sub

'Setzt Multiline für ToastMessageShow
Public Sub SetHudMultiline
    Dim no1 As NativeObject = Main.App.KeyController
    no1 = no1.GetField("view")
    Dim no2 As NativeObject
    Dim hud As NativeObject = no2.Initialize("MMBProgressHUD").RunMethod("HUDForView:", Array(no1))
    If hud.IsInitialized Then
        Dim L As Label = hud.GetField("label")
        
        If L.Text.MeasureWidth(L.Font) > (GetDeviceLayoutValues.Width - 100) Then
            Dim str As String
            Dim txt() As String = Regex.Split(" ", L.Text)
            L.Text = ""
            For i = 0 To txt.Length - 1
                str = str & txt(i)
                If str.MeasureWidth(L.Font) < (GetDeviceLayoutValues.Width - 100) Then
                    txt(i) = txt(i) & " "
                Else
                    txt(i) = txt(i) & CRLF
                    str = ""
                End If
            Next
            For i = 0 To txt.Length - 1
                L.Text = L.Text & txt(i)
            Next
        End If
        L.Multiline = True
    End If
End Sub
 

toro1950

Active Member
Licensed User
Grazie Filippo, non è aumentato di molti caratteri ma mi ha permesso di inserire dei buoni messaggi. Sicuramente dipende dal carattere utilizzato, ma non so come cambiarlo. Grazia di nuovo
 
Top