B4J Question Equivalent to Delphi's ProcessMessages?

Discussion in 'B4J Questions' started by RichardKirk, Jun 19, 2015.

  1. RichardKirk

    RichardKirk New Member Licensed User

    I've managed to do most things with B4J that I could do in Delphi, and am sooo impressed!
    My problem is as follows:
    If the user presses an 'Alt-S' an extract of data is done.
    I have achieved all this with no problem BUT I need to change the Mouse cursor and the color of the text of a button before the processing is done. I have used a timer, but the color and mouse cursor do not change - any ideas/suggestions?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    What is your program doing at that point? Why is it slow?
     
  3. RichardKirk

    RichardKirk New Member Licensed User

    The program will connect to a Postgres Database, and a MS=SQLServer database, and extract data from both
    on certain criteria, and then export the resultant information to a csv file for use by excel. The csv file creation, the
    connections and extracts all work perfectly. The user has requested, however, that there is no indication that the program
    is actually doing anything - the following snippet of code is where things need to be done (I guess):
    If KeyCode = "S" Then
    btnExtract.Style = "-fx-text-fill: Red;"
    MainForm.RootPane.MouseCursor = fx.Cursors.WAIT
    DoTheExtract 'The routine that does the connection and extract
    MainForm.RootPane.MouseCursor = fx.Cursors.DEFAULT
    InitialKey = False
    MainForm.Close
    End If
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    I understand the problem. The UI will not be updated as long as the main thread is busy.

    You need to find the slow step and see how you can make it asynchronous or faster. For example you can use async queries instead of regular queries.
     
  5. RichardKirk

    RichardKirk New Member Licensed User

    Thank you - now working as required!
     
Loading...