B4J Question How to instantly invalidate/draw canvas

kimstudio

Active Member
Licensed User
Longtime User
In B4J I found the canvas will not update instantly in a sub if there are following codes, for following example, how can the canvas update before run into for loop?
If I put sleep in between then it updates but is this the correct way? In old win32 time we have postmessage to release control to event loop to update UI.

code:
sub button1_click
    func_a 
end sub

sub func_a
    canvas.draw
    canvas.invalidate
    'sleep(10)   '-- if I put this then it can update before run into for loop
    for i = 1 to 1000000000000000
          calc
    next
end sub
 
Top