B4A Library [B4X] [XUI] AnotherProgressBar

Discussion in 'Additional libraries, classes and official updates' started by Erel, Nov 1, 2018.

Thread Status:
Not open for further replies.
  1. Erel

    Erel Administrator Staff Member Licensed User

    Edit: Latest version of AnotherProgressBar with several important improvements is available in XUI Views: https://www.b4x.com/android/forum/threads/100836/#content

    [​IMG]

    A simple, cross platform, indeterminate progress bar.

    Depends on BitmapCreator v4.50+: https://www.b4x.com/android/forum/threads/b4x-xui2d-box2d-game-engine.95208/

    It uses the new BitmapCreator async drawing features.

    The relevant code is:
    Code:
    Private Sub BusyLoop
       
    Dim MyIndex As Int = BusyIndex
       
    Do While MyIndex = BusyIndex
           
    If Vertical Then
               BusyBrush.SrcOffsetY = BusyBrush.SrcOffsetY + 
    3
           
    Else
               BusyBrush.SrcOffsetX = BusyBrush.SrcOffsetX - 
    3
           
    End If
           
    Dim tasks As List
           tasks.Initialize
           tasks.Add(bc.AsyncDrawRect(bc.TargetRect, TransparentBrush, 
    True0))
           tasks.Add(bc.AsyncDrawRectRounded(bc.TargetRect, BusyBrush, 
    True015))
           bc.DrawBitmapCreatorsAsync(Me, 
    "BC", tasks)
           
    Wait For BC_BitmapReady (bmp As B4XBitmap)
           
    If xui.IsB4J Then bmp = bc.Bitmap
           bc.SetBitmapToImageView(bmp, mIV)
           Sleep(
    16)
       
    Loop
    End Sub
    A B4A project is attached. The custom view class is inside.

    Updates:

    v1.01 - Fixes an issue with the label visibility.
     
    Last edited: Jan 20, 2019 at 7:47 AM
  2. asales

    asales Well-Known Member Licensed User

    If I start the AnotherProgressBar with visible = False in the designer, the text is not show, when the progress become visible.

    If I use "AnotherProgressBar1.Visible = False" in the code, after load the layout, works.

    Why this behavior?
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Fixed in v1.01.
     
    peacemaker, asales and Johan Hormaza like this.
  4. LucaMs

    LucaMs Expert Licensed User

  5. LordZenzo

    LordZenzo Well-Known Member Licensed User

    does not work
    I'll explain
    start the progress bar before starting a cycle of calculations that can last a few minutes, and the progress bar remains stationary
    it only moves if I replace the Sleep (16) with a deprecated DoEvents
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    I've removed your project based on DoEvents. This is a bad practice.

    1. Latest version of AnotherProgressBar with several important improvements is available in XUI Views: https://www.b4x.com/android/forum/threads/100836/#content

    2. Read the instructions in that link. There is one line of code that should go in Activity_Resume.
     
Thread Status:
Not open for further replies.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice