Hi,
I am using CSBuilder on a Label,
for a reason that I do not understand, the Height I am getting from MeasureMultilineTextHeight ,
is not as it should be, it is too short for all the text.
Thanks in advance.
I am using CSBuilder on a Label,
for a reason that I do not understand, the Height I am getting from MeasureMultilineTextHeight ,
is not as it should be, it is too short for all the text.
Thanks in advance.
B4X:
Sub DrawListView
Dim Table As List
Dim i As Int
Dim su As StringUtils
'
clvDoh.Clear
Dim sQuery As String
sQuery="select * " & _
" from kriot WHERE LeTarik = " & _
DBUtils.Fmsg(sCurDate)
If Starter.bShowAll = False Then
sQuery=sQuery & " AND status = 0 "
End If
'
sQuery=sQuery & " ORDER BY status,RecId"
Table = DBUtils.ExecuteMemoryTable(Starter.sql,sQuery ,Null , 0)
If Table.Size =0 Then Return ' if no records
For i = 0 To Table.Size - 1 'Creating The Itmes Parents and childs
Cols = Table.Get(i)
clvDoh.Add(CreateListItem( clvDoh.AsView.Width, clvDoh.AsView.Height) , $"Item #${i}"$) '24-10-2019
Next
End Sub
Sub CreateListItem( Width As Int, Height As Int) As Panel
Dim p As Panel
Dim su As StringUtils
Dim stmp As String
Dim item As ItemProp
p.Initialize("")
p.SetLayout(0 , 0, Width, Height) '24-10-2019
p.LoadLayout("listitem")
p.Color = Colors.White
lblDetails.TextColor = Colors.Black
lblTel.TextColor = Colors.Black
Try
item.Initialize
item.Recid = Cols(0)
item.MisparTofes = Cols(1)
item.Shlav = Cols(13)
lblDetails.Tag = item '
If ModFunc.Val (Cols(13)) > 0 Then
stmp = Cols(6).Trim & " [ ק " & Cols(1) & "/" & Cols(13) & " ]" & CRLF & Cols(5).Trim 'sha + shemlako
Else
stmp = Cols(6).Trim & " [ ק " & Cols(1) & " ]" & CRLF & Cols(5).Trim 'sha + shemlako
End If
If ModFunc.Len(Cols(7)) > 0 Then 'ktovetlako
stmp = stmp & CRLF & Cols(7)
End If
If ModFunc.Len(Cols(10)) > 0 Then 'teorparit
stmp = stmp & CRLF & "תאור: " & Cols(10)
End If
If ModFunc.Len(Cols(11)) > 0 Then 'degem
stmp = stmp & CRLF & "דגם: " & Cols(11)
End If
'===================================
'26-11-2017
If Starter.bShowTarikHatkana Then
If ModFunc.Len(Cols(25)) > 0 And Cols(25) <> "01.01.1900" Then 'TarikHatkana
stmp = stmp & CRLF & "תאריך התקנה: " & Cols(25)
End If
End If
'===================================
If ModFunc.Len(Cols(12)) > 0 Then 'takala
stmp = stmp & CRLF & Starter.sTakalaName & Cols(12) '26-09-2019
End If
stmp = stmp & CRLF
'==================================
'21-01-2018
If ModFunc.Len(Cols(12)) > 0 Then 'takala
cs = ModFunc.MarkPattern2(stmp, "\d\d\d\d\d\d\d\d\d+", 0,Starter.sTakalaName & Cols(12)) '19-11-2019
Else
cs = ModFunc.MarkPattern(stmp, "\d\d\d\d\d\d\d\d\d+", 0)
End If
lblDetails.Text = cs
cs.EnableClickEvents(lblDetails)
'==================================
lblTel.Text = Cols(8)
If Cols(34).Length > 0 Then '26-09-2019 Akrai
lblTel.Text = Cols(8) & CRLF & Cols(34)
lblTel.Height = su.MeasureMultilineTextHeight (lblTel,lblTel.Text) + 1%y '18-11-2019
End If
'==================================
'02-01-2018
lblHatra.Visible = False
If ModFunc.Val(Cols(18)) > 0 Then
lblHatra.Top = lblTel.Top + lblTel.Height + 0.5%y '19-11-2019
lblHatra.Text = "התראה " & Cols(18) & " דק'"
lblHatra.Visible = True
End If
'==================================
If stmp.Length > 0 Then
lblDetails.Height= su.MeasureMultilineTextHeight(lblDetails, cs )+ 2%y
iItemHeight = lblDetails.Height
End If
'==================================
'07-01-2018
lblOved.Visible = False
If Starter.bMenahelAvoda Then
If ModFunc.Len(Cols(26)) > 2 Then
'18-11-2019 = Adding Cols(15)
lblOved.Text = "טכנאי: " & Cols(15) & " | " & Cols(26).SubString2(0,Cols(26).Length -2)
lblOved.Visible = True
lblOved.Top = lblDetails.Top + lblDetails.Height + 2%y
iItemHeight = iItemHeight + lblOved.Height
Else
If ModFunc.Len(Cols(15)) > 2 Then
lblOved.Text = "טכנאי: " & Cols(15)
lblOved.Visible = True
lblOved.Top = lblDetails.Top + lblDetails.Height + 2%y
iItemHeight = iItemHeight + lblOved.Height + 2%y
End If
End If
End If
'==================================
Catch
Log(LastException)
End Try
p.Height = iItemHeight '24-10-2019
Return p
End Sub