You can use the NUM-LOCKED-COLUMNS attribute to prevent one or more browse columns from scrolling out of the browse viewport when the horizontal scrollbar is used. A nonhorizontal-scrolling column is referred to as a locked column.

Locked columns are always the leftmost columns in the browse. In other words, if you set NUM-LOCKED-COLUMNS to 2, the first two columns listed in the DEFINE BROWSE statement are locked. In the next example, the Order Number and Order Date never move out of the browse viewport, no matter which of the remaining fields the user accesses with the horizontal scrollbar.

To experiment with locking columns:

  1. Double-click on the OrderBrowse to go into its property sheet.
  2. Click the Fields button to edit the field list.
  3. Click the Add button and add all the rest of the Order fields to the browse. Do not add any Customer fields, as they just repeat all the values from the Customer record you are already displaying above the browse.
  4. Back in the property sheet, set Locked Columns to 2. The AppBuilder generates a statement from this setting to set the NUM-LOCKED-COLUMNS attribute at run time, because this attribute cannot be set using a keyword in the DEFINE BROWSE statement:
    ASSIGN
      OrderBrowse:NUM-LOCKED-COLUMNS IN FRAME CustQuery = 2.
  5. Run the window again. You can scroll through all the rest of the Order columns, but the first two columns are always displayed: