Italian regex.split

Sagenut

Expert
Licensed User
Longtime User
Come faccio a sapere se il testo contenuto un una label si visualizza tutto oppure no in base all'altezza impostata della label?
Aggiungi la libreria
StringUtils
e usa
B4X:
su.MeasureMultilineTextHeight
 

Fulvio75

Well-Known Member
Licensed User
Applicata agli item della CLW?


clwResult.AddTextItem(Text,"")
clwResult.ResizeItem(0,su.MeasureMultilineTextHeight(clwResult.GetPanel(0),clwResult.GetPanel(0).Text))

non funziona cosa sbaglio?
 

Fulvio75

Well-Known Member
Licensed User
ok risolto


private Sub CLW_Write(Text As String,Color As Int)

Dim strUtil As StringUtils
Dim CLWItem As CLVItem
Dim CLWlbl As Label

CLWItemsCount = CLWItemsCount+1

If Text <> "" Then

clwResult.DefaultTextColor = Color
clwResult.AddTextItem(Text,"")

Else

clwResult.AddTextItem(Text,"")

End If

CLWItem = clwResult.GetRawListItem(CLWItemsCount-1)

For Each lbl As B4XView In CLWItem.Panel.GetAllViewsRecursive
If lbl Is Label Then
CLWlbl = lbl
Exit
End If
Next

clwResult.ResizeItem(CLWItemsCount-1,strUtil.MeasureMultilineTextHeight(CLWlbl,CLWlbl.Text))

clwResult.JumpToItem(CLWItemsCount-1)

End Sub
 

Fulvio75

Well-Known Member
Licensed User
Ancora meglio:

B4X:
private sub CLWItem_Resize(CLW as CustomListView,ItemIndex as int)
    
    Dim strUtil As StringUtils
    Dim CLWItem As CLVItem
    Dim CLWlbl As Label

    'Trovo l'item della CLW
    CLWItem = CLW.GetRawListItem(ItemIndex)
    
    For Each lbl As B4XView In CLWItem.Panel.GetAllViewsRecursive
        If lbl Is Label Then
            CLWlbl = lbl
            Exit
        End If
    Next
    
    CLW.ResizeItem(ItemIndex,strUtil.MeasureMultilineTextHeight(CLWlbl,CLWlbl.Text))
    
End Sub
 
Top