Salesforce

How Do I Display a Control on Top of Another Control? (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

How Do I Display a Control on Top of Another Control? (Magic xpa 4.x)

When creating GUI screens, there is an issue when one control occupies the same physical space as another, namely, which control will be on top? This is handled in programs by using something called z-order, which refers to the order in which the controls are painted on the screen. Items with a low z-order will be perceived as being “behind” the ones with the higher z-order.

Magic xpa, by default, handles the z-order of the controls automatically, and usually that works fine. There will be occasions where for one reason or the other you will need to manually set the z-order.

Viewing the Z-order

In order to see what the current z-order is, you can press the Z Order toolbar icon (for Display forms) or the Display Z-order icon on the Commands palette (Drawing->Order->Display Z-order) (for Output forms). In this instance, we have several fields that are “behind” the group box. You can see this from their z-order: the group box is a 5, while the disappeared fields are 1-4.

Manually Using Z-order

  1. To set the z-order manually, you first need to turn off the Automatic Z-Order feature in Magic xpa. Do this by setting the Automatic Z-order form property to False (for Display forms), clicking on the Automatic Z-order icon on the Document Outline pane (for Display forms) or on the Command palette (Drawing->Order->Automatic Z-order) (for Output forms).

  2. Now, when you select a control, you will see some new options available on the Command palette (for Output forms) or on the toolbar (for Display forms). You can use either Bring to the Front or Bring forward one level to make your controls visible.

Hint: To select controls that you can’t see, keep pressing the tab key. You will see the selection box even though you can’t see the control itself. Or, you can select Drawing->Controls Tree to get a quick view of all the controls on the form.

Note:

Although you can change the Z-order of controls, at runtime, Windows may ignore that change. For example, when placing labels on a Windows control such as Button. Since version: 2.3

Attaching the control

When you are displaying one field as part of another field, for example text that is on a group box, you can also just attach one control onto the other. When you do this, the attached control will always be visible and will not disappear behind the background control, even without dealing with the z-order. To attach one control onto another, do the following:

  1. Select the items you want to attach, by holding down the Ctrl key while clicking on the items.

  2. Click on the link symbol .

  3. Click on the background control.

Now the controls will be attached to the background.

Reference
Attachment 
Attachment