Class TImpColumn (unit Impstringgrid) |
Inherits from
TCollectionItem
constructor Create(Collection: TCollection);
- TImpColumn
procedure Assign(Source: TPersistent);
function DefaultAlignment: TAlignment;
function DefaultColor: TColor;
if Assigned(Field) then Result := FField.
function DefaultFont: TFont;
function DefaultImeMode: TImeMode;
function DefaultImeName: TImeName;
function DefaultReadOnly: Boolean;
function DefaultWidth: Integer;
Result := (Assigned(Grid) and Grid.
destructor Destroy;
Grid.
procedure RestoreDefaults;
function CreateTitle: TImpColumnTitle;
PopupMenu := TImpColumn(Source).
function GetDisplayName: string;
function GetGrid: TImpStringGrid;
procedure RefreshDefaultFont;
procedure FontChanged(Sender: TObject);
if Assigned(Field) then
begin
RestoreCanvas := not HandleAllocated;
if RestoreCanvas then
Canvas.
function GetAlignment: TAlignment;
function GetColor: TColor;
function GetFont: TFont;
function GetField: TField;function TImpColumn.
function GetImeMode: TImeMode;
Result := FFieldName;
if Result = '' then
function GetImeName: TImeName;
function GetPickList: TStrings;
function GetReadOnly: Boolean;
function GetWidth: Integer;
function IsAlignmentStored: Boolean;
function IsColorStored: Boolean;
function IsFontStored: Boolean;
function IsImeModeStored: Boolean;
function IsImeNameStored: Boolean;
function IsReadOnlyStored: Boolean;
function IsWidthStored: Boolean;
procedure SetAlignment(Value: TAlignment);
procedure SetButtonStyle(Value: TImpColumnButtonStyle);
procedure SetColor(Value: TColor);
procedure SetFont(Value: TFont);
procedure SetField(Value: TField); virtual; procedure SetFieldName(const Value: String);procedure TImpColumn.
procedure SetImeMode(Value: TImeMode);
procedure SetImeName(Value: TImeName);
procedure SetPickList(Value: TStrings);
procedure SetReadOnly(Value: Boolean);
procedure SetPopupMenu(Value: TPopupMenu);procedure TImpColumn.
procedure SetTitle(Value: TImpColumnTitle);
procedure SetWidth(Value: Integer);
property Alignment : TAlignment
property Field: TField read GetField write SetField;
property ButtonStyle : TImpColumnButtonStyle
property Color : TColor
property DropDownRows : Cardinal
property Font : TFont
property FieldName: String read FFieldName write SetFieldName;
property ImeMode : TImeMode
property ImeName : TImeName
property PickList : TStrings
property ReadOnly : Boolean
property PopupMenu: TPopupMenu read FPopupMenu write SetPopupMenu;
property Title : TImpColumnTitle
property Width : Integer
property AssignedValues : TImpColumnValues
property Grid : TImpStringGrid
FAlignment : TAlignment;
FAssignedValues : TImpColumnValues;
FButtonStyle : TImpColumnButtonStyle;
FColor : TColor;
FDropDownRows : Cardinal;
FPopupMenu: TPopupMenu;
FFont : TFont;
FImeMode : TImeMode;
FImeName : TImeName;
FPickList : TStrings;
FReadonly : Boolean;
FTitle : TImpColumnTitle;
FWidth : Integer;
constructor Create(Collection: TCollection);
TImpColumn
procedure Assign(Source: TPersistent);
function DefaultAlignment: TAlignment;
function DefaultColor: TColor;
if Assigned(Field) then Result := FField.Alignment else
function DefaultFont: TFont;
function DefaultImeMode: TImeMode;
function DefaultImeName: TImeName;
function DefaultReadOnly: Boolean;
function DefaultWidth: Integer;
Result := (Assigned(Grid) and Grid.ReadOnly) or (Assigned(Field) and FField.ReadOnly);
destructor Destroy;
Grid.EndLayout;
procedure RestoreDefaults;
function CreateTitle: TImpColumnTitle;
PopupMenu := TImpColumn(Source).PopupMenu;
function GetDisplayName: string;
function GetGrid: TImpStringGrid;
procedure RefreshDefaultFont;
procedure FontChanged(Sender: TObject);
if Assigned(Field) then
begin
RestoreCanvas := not HandleAllocated;
if RestoreCanvas then
Canvas.Handle := GetDC(0);
try
Canvas.Font := Self.Font;
GetTextMetrics(Canvas.Handle, TM);
Result := Field.DisplayWidth * (Canvas.TextWidth('0') - TM.tmOverhang)
+ TM.tmOverhang + 4;
if dgTitles in Options then
begin
Canvas.Font := Title.Font;
W := Canvas.TextWidth(Title.Caption) + 4;
if Result < W then
Result := W;
end;
finally
if RestoreCanvas then
begin
ReleaseDC(0,Canvas.Handle);
Canvas.Handle := 0;
end;
end;
end
else
function GetAlignment: TAlignment;
function GetColor: TColor;
function GetFont: TFont;
function GetField: TField;
function TImpColumn.GetField: TField;
var
Grid: TImpStringGrid;
begin { Returns Nil if FieldName can't be found in dataset } { Grid := GetGrid;
if (FField = nil) and (Length(FFieldName) > 0) and Assigned(Grid) and
Assigned(Grid.DataLink.DataSet) then
with Grid.Datalink.Dataset do
if Active or (not DefaultFields) then
SetField(FindField(FieldName));
Result := FField;
end;
function GetImeMode: TImeMode;
Result := FFieldName;
if Result = '' then
function GetImeName: TImeName;
function GetPickList: TStrings;
function GetReadOnly: Boolean;
function GetWidth: Integer;
function IsAlignmentStored: Boolean;
function IsColorStored: Boolean;
function IsFontStored: Boolean;
function IsImeModeStored: Boolean;
function IsImeNameStored: Boolean;
function IsReadOnlyStored: Boolean;
function IsWidthStored: Boolean;
procedure SetAlignment(Value: TAlignment);
procedure SetButtonStyle(Value: TImpColumnButtonStyle);
procedure SetColor(Value: TColor);
procedure SetFont(Value: TFont);
procedure SetField(Value: TField); virtual; procedure SetFieldName(const Value: String);
procedure TImpColumn.SetField(Value: TField);
begin
if FField = Value then Exit;
FField := Value;
if Assigned(Value) then
FFieldName := Value.FieldName;
Changed(False);
end; } {procedure TImpColumn.SetFieldName(const Value: String);
var
AField: TField;
Grid: TImpStringGrid;
begin
AField := nil;
Grid := GetGrid;
if Assigned(Grid) and Assigned(Grid.DataLink.DataSet) and
not (csLoading in Grid.ComponentState) and (Length(Value) > 0) then
AField := Grid.DataLink.DataSet.FindField(Value); { no exceptions } { FFieldName := Value;
SetField(AField);
Changed(False);
end;
procedure SetImeMode(Value: TImeMode);
procedure SetImeName(Value: TImeName);
procedure SetPickList(Value: TStrings);
procedure SetReadOnly(Value: Boolean);
procedure SetPopupMenu(Value: TPopupMenu);
procedure TImpColumn.SetPopupMenu(Value: TPopupMenu);
begin
FPopupMenu := Value;
if Value <> nil then Value.FreeNotification(GetGrid);
end;
procedure SetTitle(Value: TImpColumnTitle);
procedure SetWidth(Value: Integer);
property Alignment : TAlignment
property Field: TField read GetField write SetField;
property ButtonStyle : TImpColumnButtonStyle
property Color : TColor
property DropDownRows : Cardinal
property Font : TFont
property FieldName: String read FFieldName write SetFieldName;
property ImeMode : TImeMode
property ImeName : TImeName
property PickList : TStrings
property ReadOnly : Boolean
property PopupMenu: TPopupMenu read FPopupMenu write SetPopupMenu;
property Title : TImpColumnTitle
property Width : Integer
property AssignedValues : TImpColumnValues
property Grid : TImpStringGrid
FAlignment : TAlignment;
FAssignedValues : TImpColumnValues;
FButtonStyle : TImpColumnButtonStyle;
FColor : TColor;
FDropDownRows : Cardinal;
FPopupMenu: TPopupMenu;
FFont : TFont;
FImeMode : TImeMode;
FImeName : TImeName;
FPickList : TStrings;
FReadonly : Boolean;
FTitle : TImpColumnTitle;
FWidth : Integer;