zOrder

zOrder(pos: Integer);

The zOrder method of the Window class places a specified form or control at the front or back of the z-order within its graphical level. This affects only windows that are siblings. (Sibling controls that have the alignContainer property do not occupy the same area on their parent. If so, use the visible property to control the window that is currently displayed.)

For non-MDI forms, this method sends the form to either the front or the back of the screen, depending on the value of the pos parameter. Consequently, forms can be displayed in front of or behind other running applications. The pos parameter indicates the position of the control relative to other controls. If the position is 1, the control is positioned at the front of the z-order. If the position is zero (0), the control appears at the back of the z-order.

Within MDI forms, the zOrder method sends MDI child forms to the front or the back of the MDI client area, depending on the value of the pos parameter.

When bringing a control to the front, if the control is already above all other overlapping siblings, the request is ignored. Conversely, when pushing a control to the back, if the control is already below all other overlapping siblings, the request is ignored. (The zOrder method does not generate a paint event if the position is unchanged.)

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

btnShowPicture_click(btn: Button input) updating;
begin
    if picture1.visible = false then
        picture1.visible := true;
        picture1.zOrder(1);
        buttonShowPicture.caption := "Hide Picture";
    else
        picture1.visible := false;
        buttonShowPicture.caption := "Show Picture";
    endif;
end;

btnInvestors_click(btn: Button input) updating;
vars
    iqForm : InvestorInquiry;
    form   : Form;
begin
    form := app.getForm("InvestorInquiry");
    if form = null then
        create iqForm;
        iqForm.centreWindow;
        iqForm.show;
    else
        iqForm := form.InvestorInquiry;
        iqForm.setFocus;              // set focus to this form
        iqForm.zOrder(1);
    endif;
end;

A child is always drawn on top of its parent.

For details about the order of controls on touchscreens when accessibility is set, see "Control Order on Touchscreens" under "Changing the Runtime Tab Sequence", in Chapter 5 of the JADE Development Environment User's Guide.

It is not possible to handle the painting of transparent controls in the correct zOrder when it involves a mixture of controls that can be directly painted by JADE and those that can only be painted separately by Windows.

As a result, transparent sibling controls are always painted before any JadeRichText, MultiMedia, JadeXamlControl, Ocx, OleControl, JadeDotNetVisualComponent, or ActiveXControl controls, regardless of their zOrder settings.