B4J Question Showing a Wait cursor in B4J when part of a B4X project

My B4X project targets Android, IOS and Java. I need to show a wait cursor for lengthy operations and am able to do that easily for Android and IOS. My problem is how to do this simply in B4J.

This is what I'm doing:
#IF B4A
ProgressDialogShow("Doing something")
#END IF
#IF B4I
Dim pd As HUD
pd.ProgressDialogShow("Doing something")
#End If
#IF B4J
******************
What to do here?
******************
#End If

Similarly I need to hide the Wait cursor as well which again is simple for Android and IOS with "ProgressDialogHide" and "pb.ProgressDialogHide" respectively.

I have seen a number of methods that can be used from Forum searches and Google searches and even from ChatGPT, but none of these seem to address the situation that this B4J project is part of a B4XPages project.

How do I achieve this in B4J which is part of a B4XPages project?
Better still, is there a B4X way of doing this that is common to all three platforms?
 

walt61

Active Member
Licensed User
Longtime User
B4X:
Dim fx As JFX
...
#If B4J
B4XPages.GetNativeParent(Me).RootPane.MouseCursor = fx.Cursors.WAIT ' Hourglass, akin to 'ProgressDialogShow'
B4XPages.GetNativeParent(Me).RootPane.MouseCursor = fx.Cursors.DEFAULT ' Default cursor, akin to 'ProgressDialogHide'
' Here, you may want to add this next line to make sure the cursor gets updated:
Sleep(0)
#End If
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Please, use [code]....[/code] to wrap your code

Why don't you use AnotherProgressBar or B4XLoadingIndicator from the XUI Views? They are cross platform

 
Upvote 1
Thanks Folks.
I'm using Walt61's solution. My ShowWaitCursor and HideWaitCursor routines are in a bas module so visual design time components are less suitable. The Me object can simply be passed as an argument to these routines. It doesn't have the ability to show text like I can in the B4A and B4I methods which I prefer to be able to do, but that's not the end of the world.
 
Upvote 0
Top