iOS Question ProgressDialog Equivalent

Sanxion

Active Member
Licensed User
Longtime User
Hi all

Could somebody please tell me what the equivalent B4i command is for the B4A command:

ProgressDialogShow("Please wait...")

Thanks
 

Sanxion

Active Member
Licensed User
Longtime User
No, probably you have implemented the ProgressDialog wrong, but it's hard to help you without seeing the code.

Jan

This is the code:

B4X:
hd.ProgressDialogShow("Please wait...")
Page1.RootPanel.RemoveAllViews
Page1.RootPanel.LoadLayout("ActivitiesA")
 
Upvote 0

JanPRO

Well-Known Member
Licensed User
Longtime User
I guess, your are hiding the dialog immediately after you have showed it, so there is no time, in which the dialog could be visible for you. Try to work with asynchronous methods to avoid this.
 
Upvote 0

Sanxion

Active Member
Licensed User
Longtime User
I guess, your are hiding the dialog immediately after you have showed it, so there is no time, in which the dialog could be visible for you. Try to work with asynchronous methods to avoid this.
Could you give an example please of how I would use asynchronous methods in this situation?
 
Upvote 0

JanPRO

Well-Known Member
Licensed User
Longtime User
You can't say it general. For example when you use a HttpJob, you would hide the dialog in the JobDone sub and don't do something like
B4X:
    Dim Job As HttpJob
    Job.Initialize("",Me)
    hd.ProgressDialogShow("Please wait...")
    Job.Download("Link")
    hd.ProgressDialogHide
But as I said this is just a guess ...
 
Upvote 0

QtechLab

Active Member
Licensed User
Longtime User
I have implemented the ProgressDialog, however, it does not appear. In B4A, we use the DoEvents command to force the UI to display the progress icon. Is there an equivalent in B4i?

Usually i use the ProgressDialog when i'm downloading some data, that is an operation that don't pause the main thread of the application.
I've tried the ProgressDialog combined with database or "loading views" operations without seeing anything.

Asynchronous method calls doesn't block the calling thread while waiting for a reply.

(For example the HTTPJOB).
In simple words:

The HTTP JOB is an object that allow you to make a call to a Web server.
After the Call your HTTP JOB object is waiting for a response from the sever without blocking the execution of your main thread.

It means that you can continue doing operation while the object is waiting for response, for example showing a ProgressDialog.

When the HTTP JOB object get a response from the server, it will raise an event that give you the status of the operation (in this sub you can hide your ProgressDialog)

I hope to have been clear and simple. My english is elementary.
 
Last edited:
Upvote 0

Sanxion

Active Member
Licensed User
Longtime User
Usually i use the ProgressDialog when i'm downloading some data, that is an operation that don't pause the main thread of the application.
I've tried the ProgressDialog combined with database or "loading views" operations without seeing anything.

Asynchronous method calls doesn't block the calling thread while waiting for a reply.

(For example the HTTPJOB).
In simple words:

The HTTP JOB is an object that allow you to make a call to a Web server.
After the Call your HTTP JOB object is waiting for a response from the sever without blocking the execution of your main thread.

It means that you can continue doing operation while the object is waiting for response, for example showing a ProgressDialog.

When the HTTP JOB object get a response from the server, it will raise an event that give you the status of the operation (in this sub you can hide your ProgressDialog)

I hope to have been clear and simple. My english is elementary.

Yes I understand...But which approach should I use? I want to show a busy indicator whilst a layout is being loaded.
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
You can first show the dialog and enable a timer with 100 miliseconds for example. Under timer_tick you can load your layout and progressshow will be visible until the load complete.
 
Upvote 0

Sanxion

Active Member
Licensed User
Longtime User
You can use CallSubDelayed or CallSubPlus to load the layout.
Erel, I have changed my code to use CallSubDelayed, however, I now receive this error: Object was not initialized (B4IPanelView). I assume this is because of the way I have changed it?

B4X:
Sub LoadSectionB
   
    hd.ProgressDialogShow("Please wait for the lessons to load...")
   
    CallSubDelayed(Me,"LoadLayoutB")
'    Page1.RootPanel.RemoveAllViews
'    Page1.RootPanel.LoadLayout("ActivitiesB")
'    PositionThePanels
'    sectionBLoaded = True
'    sectionALoaded = False
    hd.ProgressDialogHide

End Sub

Sub LoadLayoutB
   
    Page1.RootPanel.RemoveAllViews
    Page1.RootPanel.LoadLayout("ActivitiesB")
    PositionThePanels
    sectionBLoaded = True
    sectionALoaded = False
   
End Sub
 
Upvote 0
Top