B4J Tutorial [BANanoWebix] Show a progressbar on long processes

Discussion in 'B4J Tutorials' started by Mashiane, Jul 27, 2019.

  1. Mashiane

    Mashiane Expert Licensed User

    Ola

    Download BANanoWebix


    Based on a request I received, the WixProgressBar comes handy for showing long processes. You just run the .SetProgressBar(elementID, config) and it will show a progressbar anytime you want to show it.

    ProgressBar.gif

    WixProgressBar
    • Item As Map
      return the item
    • SetType (sType As Object) As WixProgressBar
      set type - top,bottom,icon
    • SetTypeTop (typeTop As Object) As WixProgressBar 'ignore
      draw a bar above the view/application
    • SetTypeBottom (typeBottom As Object) As WixProgressBar 'ignore
      draws a bar below a view/application
    • SetTypeIcon (typeIcon As Object) As WixProgressBar 'ignore
      draw an icon in the middle of a view/application
    • SetIcon (icon As Object) As WixProgressBar
      icon name to display from font awesome
    • SetDelay (delay As Int) As WixProgressBar
      life time in milliseconds of the progress bar, after which it is hidden (if hide parameter is enabled)
    • SetHide (hide As Boolean) As WixProgressBar
      specifies whether a progress bar/icon should be hidden after its life time
    • SetPosition (position As Double) As WixProgressBar
      an optional parameter, true only for the progress bar. Specifies the position of a progress mark on a bar. Varies from 0 to 1.
    Usage of the class.

    Code:
    Dim pbx As WixProgressBar
        pbx.Initialize(
    "").SetTypeIcon("").SetDelay(500).SetHide(True)
        pg.SetProgressBar(
    "propbag", pbx)
    We want to show a progress bar for 500 milliseconds and hide it and it should be placed at the center of the "progbar"

    Ta!
     
    Last edited: Jul 27, 2019
  2. Mashiane

    Mashiane Expert Licensed User

    The other variations are top and bottom, for top

    Code:
    Dim pbx As WixProgressBar
        pbx.Initialize(
    "").SetDelay(500).SetHide(True).SetTypeTop("")
        pg.SetProgressBar(
    "propbag", pbx)
    ProgressBar1.gif

    You can guess what bottom does..

    Ta!
     
  3. Mashiane

    Mashiane Expert Licensed User

    You can show the progress bar indefinately by leaving the delay and hide options out. Doing that will mean you will unset it off yourself. You can unset it by executing

    .UnsetProgressBar("propbar") in this example.

    Internally these functions are...

    Code:
    'set a progress bar to an element
    Sub SetProgressBar(eid As String, pbdef As WixProgressBar)
        eid = eid.tolowercase
        
    Dim pb As BANanoObject = webix.GetField("ProgressBar")
        
    Dim itm As BANanoObject = Dollar.Selector(eid)
        webix.RunMethod(
    "extend"Array(itm, pb))'
        itm.RunMethod("showProgress", pbdef.Item)
    End Sub

    'unset the progress bar
    Sub UnsetProgressBar(eid As String)
        eid = eid.ToLowerCase
        Dollar.Selector(eid).RunMethod(
    "hideProgress",Null)
    End Sub
     
    joulongleu likes this.
  4. slayerr

    slayerr New Member

    facing problem in doing this. You may refer uptobox guide. It might be helpful in resolving this issue.
     
    Last edited: Nov 25, 2019
    Mashiane likes this.
  5. Mashiane

    Mashiane Expert Licensed User

    You need to guide me perhaps with an error log or something. I see you are a new member here, welcome aboard.

    It's going to be difficult to help without understanding what the promlem is, don't you want to PM me instead so that I take you through solving the issue
     
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