refreshNow

refreshNow();

The refreshNow method of the Window class forces an immediate repaint or update of a form or control. This paint is completed on return from this method. This immediate repaint can cause problems in situations where the parent of a control is awaiting an ordinary paint and the clipControls property is not set. The effects may be that the non-client area (border) of the control is overwritten by the paint of the parent.

Use this method to force a complete repaint of a form or control when you want a form to display completely while another form is loading, or when you want to update the contents of a control.

Generally, painting a form or control is handled automatically. The paint occurs at a point when other events have completed. However, there may be situations where you want the form or control updated immediately.

Use the refreshNow method instead of the doWindowEvents method of the Window class when the object is to update the image only; for example, when displaying a running status.

The doWindowEvents method lets in any waiting Windows message, which can result in some unwanted side effects as the processing of the current message has not yet been completed.

If a parent of the window that is refreshed still has an outstanding paint event, the child window is also painted again after the parent is painted.

The methods in the following examples show the use of the refreshNow method.

btnOK_click(btn: Button input) updating;
vars
    obj   : Object;
    count : Integer;
begin
    if class01.value then
        if beginNote.value  then
            foreach obj in ClassNoteClass_01.instances do
                classNoteClass_01 := obj.ClassNoteClass_01;
                beginNotification(obj, Any_System_Event,
                                  Response_Continuous, 11199);
                count := count + 1;
            endforeach;
            staLine.caption := count.String & ' notifications set';
        elseif endNote.value then
            foreach obj in ClassNoteClass_01.instances do
                classNoteClass_01 := obj.ClassNoteClass_01;
                endNotification(obj, Any_System_Event);
                count := count + 1;
            endforeach;
            staLine.caption := count.String & ' notifications ended';
        endif;
    endif;
end;

btnInitialize_click(btn: Button input) updating;
vars
    num   : Number;
    count : Integer;
begin
    // Creates 5000 Number objects & enters them into the numbers collection
    staLine.caption := "Initializing data...";
    staLine.refreshNow;
    beginTransaction;
        foreach count in 1 to 5000 do
            create num;
            num.key := count;
            numbers.add(num);
        endforeach;
    commitTransaction;
    // Resets the status line and enables the two buttons.
    // The initialize button is then disabled.
    staLine.caption       := "";
    btnClientExec.enabled := true;
    btnServExec.enabled   := true;
    btnInitialize.enabled := false;
end;

For more details, see "Windows Events and JADE Events", later in this document.