CoolControl Items

Items

    Now it's time to put something useful into the grid we created. The most important thing to realize is how the physical layout of the Grid is completely disconnected from the "view" of the individual items it contains. The view of the items is defined by the ICoolItem interface, this allows the implementation to be defined by the control. CoolControl has a default implementation of this interface in the TCoolItem class. You are free to derive from this object or define your own.

  This interface is based on the ICoolStorageObject object. Here is an overview of that interface.

  Lets take a look at this interface to see what it consists of.

ICoolItem = interface(ICoolStorageObject)
  [IID_ICoolItem]
  function GetGroupID: Integer;
  function GetRelativeIndex: Integer;
  function GetVisibleGroupID: Integer;
  function GetVisibleRelativeIndex: Integer;

  // Logical Group the item is a member of
  property GroupID: Integer read GetGroupID;
  // Index with respect to the group the item is in
  property RelativeIndex: Integer read GetRelativeIndex;
  // Visual Group the item is a member of
  property VisibleGroupID: Integer read GetVisibleGroupID;
  // Index with respect to the group the item is in
  property VisibleRelativeIndex: Integer read GetVisibleRelativeIndex;
end;

   This interface expands the ICoolStorageObject by adding properties necessary for an item in the CoolControl.

  These properties all have to do with indexing of the item. Just as in the ICoolStorageObject index properties there are two flavors of indexing, Visible and Logical. The GroupID property is the index of the Group the item is in without consideration of the visibility of the groups. The VisibleGroupID property is the index of the group the item is in where only visible groups are considered. The RelativeIndex and VisibleRelativeIndex are the indexes of the items referenced from the start of the group. So the first item in each group will have a RelativeIndex of 0 the next 1 and so on. Just like in the ICoolStorageObject the Visible properties are to index items that are currently displayed in the Grid while the logical index will correspond to the users data that does not care about visibility of the object.

 


mustangpeak.net

  Last Modified on: