B4J Question Mouse Cursor Delay in Changing

melliott

Member
Licensed User
Longtime User
Hello,

Just before performing a timely operation I am setting the mouse cursor to WAIT as so:

MainFrom.RootPane.MouseCursor = fx.Cursors.WAIT

When I add the code for my long running process after the above line (which connects to a database) the cursor does not change. I tried putting a huge for-loop before it and also using a timer. Still, my mouse cursor changes after my process.

What can you recommend to get the MouseCursor to be visible as fx.Cursors.WAIT before my process runs?

Thanks,

Michael
 

melliott

Member
Licensed User
Longtime User
>> Can you provide more information about the timely operation? Why is it slow?

I am using jSQL to connect to multiple databases to get stats. I would not say it is slow - just takes about 5-15 seconds to connect to the databases and get the values. It works fine. I'd like to simply change to cursor to an hour glass before the process starts then change it back after the process.

In tests I have no issue changing the cursor to an hour glass via: MainFrom.RootPane.MouseCursor = fx.Cursors.WAIT

For some reason issue that code then attempting to connect to multiple databases via jSQL inhibits that cursor from changing.

conn.InitializeAsync("conn", "oracle.jdbc.driver.OracleDriver", _
"jdbc:racle:thin://DB01:1521/MyDB","SCOTT","tiger")

<<add values to TableView1 from ResultSet >>

conn.InitializeAsync("conn", "oracle.jdbc.driver.OracleDriver", _
"jdbc:racle:thin://DB02:1521/MyDB","SCOTT","tiger")

<<add values to TableView1 from ResultSet >>

conn.InitializeAsync("conn", "oracle.jdbc.driver.OracleDriver", _
"jdbc:racle:thin://DB03:1521/MyDB","SCOTT","tiger")

<<add values to TableView1 from ResultSet >>

MainFrom.RootPane.MouseCursor = fx.Cursors.DEFAULT





What can you recommend?
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
InitializeAsync is a non-blocking call. This means that you are changing the cursor to the wait cursor and then immediately change it back to the default cursor.


I don't see how your code can work as you are reading from the connection before it is ready. You can only work with the connection after the Ready event is raised.
 
Upvote 0
Top