paintIfRequired

paintIfRequired() clientExecution;

The paintIfRequired method of the Form class causes the form to be repainted if a repaint is required; for example, while performing a long processing loop, to ensure that the user presentation is updated after the user brings another application to the front and then returns to Jade.

The Jade executable calls the DisableProcessWindowsGhosting() Microsoft API on initiation, which disables Windows’ ghosting so that a non-responsive form does not show Not Responding, nor does it have the ghosting effect applied by Windows. However, the form will still not automatically paint itself when the presentation thread is busy processing Jade logic. Windows automatically redraws that part of the form or forms that need refreshing from a saved copy of the previously painted image or images.

A refreshNow event is performed on that part of the form that needed refreshing. If paint events are not required, no action is performed.

The paintIfRequired method performs any repainting required without having to perform an app.doWindowEvents method call, and therefore does not allow the user interface to be active.

Other than any paint events, no other events, notifications, or timer events will be processed as a result of this paintIfRequired method call.

After a repaint, any clicked button that initiated the processing loop will be drawn in the up position, so it will be important that the user is given a visual indication that the processing is still progressing by some other means; for example, by using the app.mousePointer := 11 (busy) property value.

You will need to add a call to your logic loop that is regularly performed; for example, call it when the Cancel button is checked for a click event, when a progress bar update ticks over a percentage, or at a specified number of seconds, as shown in the following code fragment.

cancelled := false;
    while not cancelled do
        // ... logic
    // the click event sets the cancelled property
    btnCancel.doWindowEvents(0);
    form1.paintIfRequired();
endwhile;