You've already forked lazarus-ccr
TRxColumn.Option - enable show/hide column from grid column dialog
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3391 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -74,6 +74,9 @@ type
|
|||||||
//TRxDBGridAllowedOperations = set of TRxDBGridAllowedOperation;
|
//TRxDBGridAllowedOperations = set of TRxDBGridAllowedOperation;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
TRxColumnOption = (coCustomizeVisible, coCustomizeWidth);
|
||||||
|
TRxColumnOptions = set of TRxColumnOption;
|
||||||
|
|
||||||
TRxColumnEditButtonStyle = (ebsDropDownRx, ebsEllipsisRx, ebsGlyphRx, ebsUpDownRx,
|
TRxColumnEditButtonStyle = (ebsDropDownRx, ebsEllipsisRx, ebsGlyphRx, ebsUpDownRx,
|
||||||
ebsPlusRx, ebsMinusRx);
|
ebsPlusRx, ebsMinusRx);
|
||||||
|
|
||||||
@@ -417,6 +420,7 @@ type
|
|||||||
FKeyList: TStrings;
|
FKeyList: TStrings;
|
||||||
FNotInKeyListIndex: integer;
|
FNotInKeyListIndex: integer;
|
||||||
FOnDrawColumnCell: TDrawColumnCellEvent;
|
FOnDrawColumnCell: TDrawColumnCellEvent;
|
||||||
|
FOptions: TRxColumnOptions;
|
||||||
FSortFields: string;
|
FSortFields: string;
|
||||||
FSortOrder: TSortMarker;
|
FSortOrder: TSortMarker;
|
||||||
FSortPosition: integer;
|
FSortPosition: integer;
|
||||||
@@ -443,18 +447,18 @@ type
|
|||||||
property SortOrder: TSortMarker read FSortOrder write FSortOrder;
|
property SortOrder: TSortMarker read FSortOrder write FSortOrder;
|
||||||
property SortPosition: integer read FSortPosition;
|
property SortPosition: integer read FSortPosition;
|
||||||
published
|
published
|
||||||
property SortFields: string read FSortFields write FSortFields;
|
|
||||||
property Footer: TRxColumnFooter read GetFooter write SetFooter;
|
|
||||||
property Constraints:TRxDBGridCollumnConstraints read GetConstraints write SetConstraints;
|
property Constraints:TRxDBGridCollumnConstraints read GetConstraints write SetConstraints;
|
||||||
property ImageList: TImageList read FImageList write SetImageList;
|
|
||||||
property KeyList: TStrings read GetKeyList write SetKeyList;
|
|
||||||
property NotInKeyListIndex: integer read FNotInKeyListIndex
|
|
||||||
write SetNotInKeyListIndex default -1;
|
|
||||||
property Filter: TRxColumnFilter read FFilter write SetFilter;
|
|
||||||
property DirectInput : boolean read FDirectInput write FDirectInput default true;
|
property DirectInput : boolean read FDirectInput write FDirectInput default true;
|
||||||
property EditButtons:TRxColumnEditButtons read FEditButtons write SetEditButtons;
|
property EditButtons:TRxColumnEditButtons read FEditButtons write SetEditButtons;
|
||||||
property OnDrawColumnCell: TDrawColumnCellEvent read FOnDrawColumnCell write FOnDrawColumnCell;
|
property Filter: TRxColumnFilter read FFilter write SetFilter;
|
||||||
|
property Footer: TRxColumnFooter read GetFooter write SetFooter;
|
||||||
|
property ImageList: TImageList read FImageList write SetImageList;
|
||||||
|
property KeyList: TStrings read GetKeyList write SetKeyList;
|
||||||
|
property NotInKeyListIndex: integer read FNotInKeyListIndex write SetNotInKeyListIndex default -1;
|
||||||
|
property Options:TRxColumnOptions read FOptions write FOptions default [coCustomizeVisible, coCustomizeWidth];
|
||||||
|
property SortFields: string read FSortFields write FSortFields;
|
||||||
property WordWrap:boolean read FWordWrap write SetWordWrap default false;
|
property WordWrap:boolean read FWordWrap write SetWordWrap default false;
|
||||||
|
property OnDrawColumnCell: TDrawColumnCellEvent read FOnDrawColumnCell write FOnDrawColumnCell;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TRxDbGridColumns }
|
{ TRxDbGridColumns }
|
||||||
@@ -5164,6 +5168,7 @@ begin
|
|||||||
FFilter := TRxColumnFilter.Create(Self);
|
FFilter := TRxColumnFilter.Create(Self);
|
||||||
FDirectInput := true;
|
FDirectInput := true;
|
||||||
FEditButtons:=TRxColumnEditButtons.Create(Self);
|
FEditButtons:=TRxColumnEditButtons.Create(Self);
|
||||||
|
FOptions:=[coCustomizeVisible, coCustomizeWidth];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TRxColumn.Destroy;
|
destructor TRxColumn.Destroy;
|
||||||
|
@@ -126,7 +126,7 @@ object rxDBGridColumsForm: TrxDBGridColumsForm
|
|||||||
end
|
end
|
||||||
object btnApply: TBitBtn
|
object btnApply: TBitBtn
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = -63
|
Left = -205
|
||||||
Height = 30
|
Height = 30
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 71
|
Width = 71
|
||||||
@@ -173,6 +173,7 @@ object rxDBGridColumsForm: TrxDBGridColumsForm
|
|||||||
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goEditing, goRowSelect, goRowHighlight]
|
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goEditing, goRowSelect, goRowHighlight]
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
TitleStyle = tsNative
|
TitleStyle = tsNative
|
||||||
|
OnClick = StringGrid1Click
|
||||||
OnValidateEntry = StringGrid1ValidateEntry
|
OnValidateEntry = StringGrid1ValidateEntry
|
||||||
ColWidths = (
|
ColWidths = (
|
||||||
30
|
30
|
||||||
|
@@ -53,6 +53,7 @@ type
|
|||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure sbUpClick(Sender: TObject);
|
procedure sbUpClick(Sender: TObject);
|
||||||
procedure sbDownClick(Sender: TObject);
|
procedure sbDownClick(Sender: TObject);
|
||||||
|
procedure StringGrid1Click(Sender: TObject);
|
||||||
procedure StringGrid1ValidateEntry(sender: TObject; aCol, aRow: Integer;
|
procedure StringGrid1ValidateEntry(sender: TObject; aCol, aRow: Integer;
|
||||||
const OldValue: string; var NewValue: String);
|
const OldValue: string; var NewValue: String);
|
||||||
private
|
private
|
||||||
@@ -159,6 +160,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TrxDBGridColumsForm.StringGrid1Click(Sender: TObject);
|
||||||
|
var
|
||||||
|
i:integer;
|
||||||
|
C:TRxColumn;
|
||||||
|
begin
|
||||||
|
i:=StringGrid1.Row;
|
||||||
|
|
||||||
|
C:=FGrid.ColumnByCaption(StringGrid1.Cells[1, i]);
|
||||||
|
if coCustomizeVisible in C.Options then
|
||||||
|
StringGrid1.Options:=StringGrid1.Options + [goEditing]
|
||||||
|
else
|
||||||
|
StringGrid1.Options:=StringGrid1.Options - [goEditing]
|
||||||
|
;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TrxDBGridColumsForm.StringGrid1ValidateEntry(sender: TObject; aCol,
|
procedure TrxDBGridColumsForm.StringGrid1ValidateEntry(sender: TObject; aCol,
|
||||||
aRow: Integer; const OldValue: string; var NewValue: String);
|
aRow: Integer; const OldValue: string; var NewValue: String);
|
||||||
begin
|
begin
|
||||||
@@ -169,20 +185,24 @@ end;
|
|||||||
procedure TrxDBGridColumsForm.SetGrid(AGrid: TRxDBGrid);
|
procedure TrxDBGridColumsForm.SetGrid(AGrid: TRxDBGrid);
|
||||||
var
|
var
|
||||||
i:integer;
|
i:integer;
|
||||||
|
C:TRxColumn;
|
||||||
begin
|
begin
|
||||||
if AGrid=FGrid then exit;
|
if AGrid=FGrid then exit;
|
||||||
FGrid:=AGrid;
|
FGrid:=AGrid;
|
||||||
if Assigned(AGrid) then
|
if Assigned(AGrid) then
|
||||||
begin
|
begin
|
||||||
StringGrid1.RowCount:=AGrid.Columns.Count + 1;
|
StringGrid1.RowCount:=AGrid.Columns.Count + 1;
|
||||||
|
|
||||||
for i:=0 to AGrid.Columns.Count-1 do
|
for i:=0 to AGrid.Columns.Count-1 do
|
||||||
begin
|
begin
|
||||||
StringGrid1.Cells[0, i+1]:=BoolToStr(AGrid.Columns[i].Visible, '1', '0');
|
C:=AGrid.Columns[i] as TRxColumn;
|
||||||
StringGrid1.Cells[1, i+1]:=AGrid.Columns[i].Title.Caption;
|
|
||||||
if AGrid.Columns[i].Width = 0 then
|
StringGrid1.Cells[0, i + 1]:=BoolToStr(C.Visible, '1', '0');
|
||||||
|
StringGrid1.Cells[1, i + 1]:=C.Title.Caption;
|
||||||
|
if C.Width = 0 then
|
||||||
StringGrid1.Cells[2, i + 1]:=IntToStr(AGrid.DefaultColWidth)
|
StringGrid1.Cells[2, i + 1]:=IntToStr(AGrid.DefaultColWidth)
|
||||||
else
|
else
|
||||||
StringGrid1.Cells[2, i+1]:=IntToStr(AGrid.Columns[i].Width);
|
StringGrid1.Cells[2, i + 1]:=IntToStr(C.Width);
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user