Control - DisplayPosition Property

DisplayPosition determines the order in which components are shown

Member of Control (PRIM_CTRL)

Data Type - Integer


DisplayPosition governs the order in which individual controls are displayed within a given parent component.
If the controls are positioned on the parent without overlapping and with no layout manager DisplayPosition is irrelevant as absolute position based on the Top and Left properties will apply.
If two or more controls overlap in anyway, DisplayPosition will determine which one is on Top. The smallest number will be on top.
If controls are positioned relative to each other by a layout manager, the DisplayPosition will be used to determine their sequence within the flow.
DisplayPositions are dynamic and will respond to changes to the DisplayPosition of another control.
Controls that are Visible(False) will maintain their DisplayPosition.


This example shows how DisplayPosition determines which control is on top.
When a button is clicked it becomes DisplayPosition(1), bringing it to the front.
Function Options(*Direct)
Begin_Com Role(*Extends #Prim_form) Height(319) Top(243) Width(510) Clientwidth(494) Clientheight(280) Left(452)
   Define_Com Class(#PRIM_PHBN) Name(#Button1) Caption('Button1') Displayposition(1) Left(61) Parent(#COM_OWNER) Tabposition(1) Top(24) Height(49) Width(124)
   Define_Com Class(#PRIM_PHBN) Name(#Button2) Caption('Button2') Displayposition(2) Left(88) Parent(#COM_OWNER) Tabposition(2) Top(56) Height(49) Width(124)
   Define_Com Class(#PRIM_PHBN) Name(#Button3) Caption('Button3') Displayposition(3) Left(120) Parent(#COM_OWNER) Tabposition(3) Top(88) Height(49) Width(124)
   Evtroutine Handling(#Button1.Click #Button2.Click #Button3.Click) Com_Sender(#Sender)
      #Sender.DisplayPosition := 1

See also

All Component Classes

Technical Reference

LANSA Version 15, April 2020