Android Question Xcustomlistview blink specific item text

PassionDEV

Well-Known Member
Licensed User
i am wondering is there a way to blink a text of a label in XCLV item , lets say i added 4 items and i want item 2 only to be blinked is this possible ?
 

mangojack

Well-Known Member
Licensed User
This is one possible way ... triggered by CLV row click.

B4X:
Sub clv2_ItemClick(Index As Int, Value As Object)
 
    Dim pnl As B4XView = clv2.GetPanel(Index)
    Dim lbl As B4XView = pnl.GetView(1)  'second view in rowitem layout view tree
 
    For i = 1 To 10     
        If i Mod 2 = 0 Then
            lbl.TextColor = Colors.Black         
        Else
            lbl.TextColor = Colors.Red
        End If
        Sleep(400)
    Next
 
End Sub
 
Upvote 0

DonManfred

Expert
Licensed User
Upvote 0

PassionDEV

Well-Known Member
Licensed User
@DonManfred now i got an idea after your correction , now i can see this work in loop in on click event i wasn't looking correctly sense i just wakeup and was looking from my phone . the idea will be
adding a timer and i will put 2 labels to the clv item one for identification that this item can be blinked and the second one for changing its text color i will share the code after i get it done

@mangojack thank you for the idea
 
Upvote 0

PassionDEV

Well-Known Member
Licensed User
here is the full timer code to blink in XCLV
B4X:
' BOOLBLINK global variable as BOOLEAN

Sub CLVINVALIDATE_tick
  
If clv.Size > 0 Then
BOOLBLINK = Not(BOOLBLINK)

For i = 0 To clv.Size - 1
  
Dim pnl As B4XView = clv.GetPanel(i)
Dim lblnm As B4XView = pnl.GetView(0) ' main label text
Dim lbl As B4XView = pnl.GetView(1)


If lbl.Text = "blink" Then
lblnm.TextColor = Colors.black

If BOOLBLINK Then
lblnm.TextColor = Colors.red
End If 

End If


  

Next


End If
  
End Sub
 
Upvote 0

udg

Expert
Licensed User
Blinking...that reminded me of an old lib/class I developed..
Oh, yes. It was named dgTextEffects.
You may be interested in the component TextSwitcher my lib was based on.

Sorry, I can't recall the exact details, but eventually I could try to search on my old HD if you feel it could be of any help.
 
Upvote 0

PassionDEV

Well-Known Member
Licensed User
sure it will help also this dgTextEffects is very useful thank you, also the code i posted can be used for blinking in clv items
 
Upvote 0
Top