B4J Question Reverse text scrollinglabel

ibra939

Active Member
Licensed User
Longtime User
I need to Reverse text of scrollinglabel how ?


 
Last edited:

ibra939

Active Member
Licensed User
Longtime User
I mean the text if can move it from right to left or left to right
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
A modified module with reverse property is attached.

The change is minimal with just the addition of a single variable:
B4X:
Dim ReverseFix As Int = IIf(mReverse, -1, 1) '<------------------
ImageView1.SetLayoutAnimated(0, 0, h, ivwidth, ivheight)
ImageView2.SetLayoutAnimated(0, ReverseFix * (ivwidth + Gap), h, ivwidth, ivheight)
If ivwidth <= mBase.Width Then
    ImageView2.Visible = False
Else
    ImageView2.Visible = True
    Dim MyIndex As Int = LoopIndex
    Dim duration As Int = ivwidth / WidthPerSecond * 1000
    Sleep(StartPositionDelay)
    If MyIndex <> LoopIndex Then Return
    Do While True
        ImageView1.SetLayoutAnimated(duration, ReverseFix * (-ivwidth - Gap), ImageView1.Top, ImageView1.Width, ImageView1.Height)
        ImageView2.SetLayoutAnimated(duration, 0, ImageView1.Top, ImageView1.Width, ImageView1.Height)
        Sleep(duration)
        If MyIndex <> LoopIndex Then Return
        Sleep(StartPositionDelay)
        If MyIndex <> LoopIndex Then Return
        ImageView1.SetLayoutAnimated(0, 0, h, ivwidth, ivheight)
        ImageView2.SetLayoutAnimated(0, ReverseFix * (ivwidth + Gap), h, ivwidth, ivheight)
    Loop
End If

Tested in B4J only.
 

Attachments

  • BBScrollingLabelWithReverse.zip
    10.3 KB · Views: 8
Upvote 0
Top