Physical vs. Logical Grid Columns

Describes the difference between physical and logical grid columns from a programming standpoint.

In addition to enabling users to move, resize, and hide grid columns from their screen, you can also do this via programming.

A grid with adjustable columns can present a significant programming challenge. To alleviate this, the grid control maintains two separate notions of the column order – one for the user and one for the program – as follows:

physical columns
These are what are seen on the screen by the user. The leftmost column is column 1, the next one to the right is column 2, and so on.
logical columns
These represent how the program understands the grid layout, and is the order in which data appears in the RECORD-DATA property for any given row. Again, this lays out left to right, but the order is based on the ordering in the record and not necessarily what appears on the screen.
Tip: Think of logical columns as "the way I laid out the grid" and physical columns as "what the user sees."

In a grid showing its default column layout, these two orderings are the same. Logical column 1 is physical column 1, and so on. However, when the user changes the column ordering on the screen (see Enabling User Grid Column Adjustments), the two notions of columns begin to differ, with the grid control managing the physical vs. logical column numbering internally. While a physical column number might change, its corresponding logical column number does not.

For example, suppose a customer's street address is normally shown on the screen of a particular grid in physical column 3; however, in this case, the user has moved it to physical column 5. If your program gets the cell data from column 3, it fetches the street address information from logical column 3 even though the position of the column is now physical column 5. In this case, when you position the cursor to logical column 3, it appears on the screen in column 5.

This makes programming the grid much simpler. In most cases, from a programming perspective, you can just ignore when the user has moved columns around on the screen as if this hasn't happened.

Important: Unless otherwise explicitly stated, this documentation references all column properties and events using logical column values, and list-style properties are listed in logical-column order.