I have the following code where I am trying to size the body of the message by the length of the text. I need to use a mono font so as to determine how to size it. While getting it to work for some reason there is extra spaces (between "the" and "Japan") and missing word ("of" after "control"). I am not sure if I am doing something wrong. I also will need to turn off scrolling but that is not in the below code yet.
Screenshot attached.
B4X:
csMsgText.Initialize.Typeface(fntMsgMono)
csMsgText.Append("Confirm that the ").Bold.Color(HiLitePwr).Append(strPower).Pop
csMsgText.Append(" Power is to take control of the territory ")
csMsgText.Bold.Color(HiLiteTerr).Append(Territory.Name).PopAll
Dialog.PutAtTop = True
tmpLongText.mBase.Width = 360dip
tmpLongText.CustomListView1.Base_Resize(356dip, 200dip)
tmpLongText.Text = csMsgText
iLen = csMsgText.Length
Log(iLen)
If iLen < 81 Then
tmpLongText.mBase.Height = 90dip
Else If iLen >= 81 And iLen <= 107 Then
tmpLongText.mBase.Height = 125dip
Else If iLen > 107 Then
tmpLongText.mBase.Height = 150dip
End If
Dim rsp As ResumableSub = Dialog.ShowTemplate(tmpLongText, "Yes", "No", "")
Dim btnYes As B4XView = Dialog.GetButton(xui.DialogResponse_Positive)
btnYes.SetBitmap(bmpBtnUp)
Dim btnNo As B4XView = Dialog.GetButton(xui.DialogResponse_Negative)
btnNo.SetBitmap(bmpBtnUp)
Wait For (rsp) Complete (Result As Int)
If Result = xui.DialogResponse_Positive Then
...
End If
Screenshot attached.