Object Reference > True DBGrid Properties > AllowFocus Property |
AllowFocus Property
Controls whether a column can receive focus.
object.AllowFocus= boolean
Read/Write at run time and design time.
If True (the default), the user will be able to interactively select the object, giving it focus.
If False, the user will not be able to interactively select the object. When clicked, the object will not receive focus and the control (or grid column) that previously had focus will retain it.
For both split and column objects, setting AllowFocus to True enables cells within the object to receive focus. If set to False, there is no way to change the focus to a cell within the object. However, if an object already has the focus, setting AllowFocus to False will not give focus to another split, column, or control.
If a cell in a column which does not allow focus is clicked, and the cell is in a row other than the current row, then the row is changed, but the column with the focus retains it.
For splits, you can use this property in combination with the AllowSizing property to completely prohibit the user from making any changes to a split (by setting both properties to False). Unselectable splits are passed over when TabAcrossSplits is set to True.
For columns, AllowFocus is a split-specific property, which means that the following statements are equivalent:
TDBGrid1.Columns(1).AllowFocus = True
TDBGrid1.Splits(TDBGrid1.Split).Columns(1).AllowFocus = True
In other words, both of these statements affect column 1 in the current split only.
Note
At design time, the AllowFocus property appears in both the Splits property page (for Split objects) and the Layout property page (for Column objects).