mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-01 13:27:18 +01:00
added column visible and autosize settings.
Shane git-svn-id: trunk@572 -
This commit is contained in:
parent
00f25d3c89
commit
86d5fa5b9c
@ -22,6 +22,8 @@ type
|
|||||||
Button4: TBUTTON;
|
Button4: TBUTTON;
|
||||||
btnOK : TBitBtn;
|
btnOK : TBitBtn;
|
||||||
btnCancel : TBitBtn;
|
btnCancel : TBitBtn;
|
||||||
|
cbVisible : TCheckbox;
|
||||||
|
cbAutoSize : TCheckBox;
|
||||||
private
|
private
|
||||||
{ private declarations }
|
{ private declarations }
|
||||||
FItems : TList;
|
FItems : TList;
|
||||||
@ -38,6 +40,8 @@ type
|
|||||||
procedure Listbox1OnClick(sender : TObject);
|
procedure Listbox1OnClick(sender : TObject);
|
||||||
Procedure Edit1OnChange(Sender : TObject);
|
Procedure Edit1OnChange(Sender : TObject);
|
||||||
Procedure Edit2OnChange(Sender : TObject);
|
Procedure Edit2OnChange(Sender : TObject);
|
||||||
|
Procedure cbVisibleOnClick(Sender : TObject);
|
||||||
|
Procedure cbAutoSizeOnClick(Sender : TObject);
|
||||||
Procedure FormOnShow(Sender : TObject);
|
Procedure FormOnShow(Sender : TObject);
|
||||||
public
|
public
|
||||||
{ public declarations }
|
{ public declarations }
|
||||||
@ -61,7 +65,7 @@ Begin
|
|||||||
begin
|
begin
|
||||||
Caption := 'Column Editor';
|
Caption := 'Column Editor';
|
||||||
Width := 400;
|
Width := 400;
|
||||||
Height := 300;
|
Height := 340;
|
||||||
OnShow := @FormOnShow;
|
OnShow := @FormOnShow;
|
||||||
Position := poScreenCenter;
|
Position := poScreenCenter;
|
||||||
Listbox1 := TListBox.Create(self);
|
Listbox1 := TListBox.Create(self);
|
||||||
@ -71,7 +75,7 @@ Begin
|
|||||||
left := 1;
|
left := 1;
|
||||||
Width := 170;
|
Width := 170;
|
||||||
Top := 1;
|
Top := 1;
|
||||||
Height := 210;
|
Height := 270;
|
||||||
Visible := True;
|
Visible := True;
|
||||||
OnClick := @Listbox1OnClick;
|
OnClick := @Listbox1OnClick;
|
||||||
end;
|
end;
|
||||||
@ -136,14 +140,40 @@ Begin
|
|||||||
ItemIndex := 0;
|
ItemIndex := 0;
|
||||||
OnClick := @RadioGroup1OnClick;
|
OnClick := @RadioGroup1OnClick;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
cbVisible := TCheckBox.Create(self);
|
||||||
|
with cbVisible do
|
||||||
|
begin
|
||||||
|
Parent := Self;
|
||||||
|
Visible := True;
|
||||||
|
Caption := 'Visible';
|
||||||
|
Left := self.width div 2;
|
||||||
|
Top := RadioGroup1.Top+RadioGroup1.Height+5;
|
||||||
|
Height := 25;
|
||||||
|
Checked := True;
|
||||||
|
OnClick := @cbVisibleOnClick;
|
||||||
|
end;
|
||||||
|
|
||||||
|
cbAutoSize := TCheckBox.Create(self);
|
||||||
|
with cbAutoSize do
|
||||||
|
begin
|
||||||
|
Parent := Self;
|
||||||
|
Visible := True;
|
||||||
|
Caption := 'Auto Size';
|
||||||
|
Left := self.width div 2;
|
||||||
|
Top := cbVisible.Top + cbVisible.Height + 5;
|
||||||
|
Height := 25;
|
||||||
|
Checked := True;
|
||||||
|
OnClick := @cbAutoSizeOnClick;
|
||||||
|
end;
|
||||||
|
|
||||||
Button1 := TButton.Create(self);
|
Button1 := TButton.Create(self);
|
||||||
with Button1 do
|
with Button1 do
|
||||||
Begin
|
Begin
|
||||||
Parent := self;
|
Parent := self;
|
||||||
Caption := 'Add';
|
Caption := 'Add';
|
||||||
Left := self.width div 2;
|
Left := self.width div 2;
|
||||||
Top := RadioGroup1.Top+RadioGroup1.Height+5;
|
Top := cbAutoSize.Top+cbAutoSize.Height+5;
|
||||||
Visible := True;
|
Visible := True;
|
||||||
OnClick := @Button1OnClick;
|
OnClick := @Button1OnClick;
|
||||||
end;
|
end;
|
||||||
@ -340,6 +370,10 @@ begin
|
|||||||
caCenter:RadioGroup1.ItemIndex := 1;
|
caCenter:RadioGroup1.ItemIndex := 1;
|
||||||
caRight : RadioGroup1.ItemIndex := 2;
|
caRight : RadioGroup1.ItemIndex := 2;
|
||||||
end; //case
|
end; //case
|
||||||
|
|
||||||
|
cbVisible.Checked := ViewColumn.Visible;
|
||||||
|
cbAutoSize.Checked := ViewColumn.AutoSize;
|
||||||
|
|
||||||
|
|
||||||
FSelectedIndex := Value;
|
FSelectedIndex := Value;
|
||||||
|
|
||||||
@ -404,6 +438,27 @@ begin
|
|||||||
Result := FItems.Add(ViewColumn);
|
Result := FItems.Add(ViewColumn);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Procedure TColumnDlg.cbVisibleOnClick(Sender : TObject);
|
||||||
|
Var
|
||||||
|
ViewColumn : TViewColumn;
|
||||||
|
begin
|
||||||
|
if FSelectedIndex = -1 then Exit;
|
||||||
|
ViewColumn := TViewColumn(FItems.Items[FSelectedIndex]);
|
||||||
|
|
||||||
|
ViewColumn.Visible := cbVisible.Checked;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure TColumnDlg.cbAutoSizeOnClick(Sender : TObject);
|
||||||
|
Var
|
||||||
|
ViewColumn : TViewColumn;
|
||||||
|
begin
|
||||||
|
if FSelectedIndex = -1 then Exit;
|
||||||
|
ViewColumn := TViewColumn(FItems.Items[FSelectedIndex]);
|
||||||
|
|
||||||
|
ViewColumn.AutoSize := cbAutoSize.Checked;
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
{ $I columndlg.lrs}
|
{ $I columndlg.lrs}
|
||||||
|
|
||||||
|
|||||||
@ -429,6 +429,14 @@ type
|
|||||||
FAlignment: TColumnAlignment;
|
FAlignment: TColumnAlignment;
|
||||||
FOnChange: TNotifyEvent;
|
FOnChange: TNotifyEvent;
|
||||||
FWidth: Integer;
|
FWidth: Integer;
|
||||||
|
FMinWidth: Integer;
|
||||||
|
FMaxWidth: Integer;
|
||||||
|
FAutoSize: Boolean;
|
||||||
|
FVisible: Boolean;
|
||||||
|
procedure SetVisible(const AValue: Boolean);
|
||||||
|
procedure SetAutoSize(const AValue: Boolean);
|
||||||
|
procedure SetMinWidth(const AValue: Integer);
|
||||||
|
procedure SetMaxWidth(const AValue: Integer);
|
||||||
procedure SetWidth(const AValue: Integer);
|
procedure SetWidth(const AValue: Integer);
|
||||||
procedure SetCaption(const AValue: String);
|
procedure SetCaption(const AValue: String);
|
||||||
|
|
||||||
@ -438,7 +446,11 @@ type
|
|||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
Property Caption : String read FCaption write SetCaption;
|
Property Caption : String read FCaption write SetCaption;
|
||||||
Property Width : Integer read FWidth write SetWidth;
|
Property Width : Integer read FWidth write SetWidth;
|
||||||
|
property MinWidth : Integer read FMinWidth write SetMinWidth;
|
||||||
|
property MaxWidth : Integer read FMaxWidth write SetMaxWidth;
|
||||||
property Alignment : TColumnAlignment read FAlignment write SetAlignment;
|
property Alignment : TColumnAlignment read FAlignment write SetAlignment;
|
||||||
|
Property AutoSize : Boolean read FAutoSize write SetAutoSize;
|
||||||
|
Property Visible : Boolean read FVisible write SetVisible;
|
||||||
property OnChange : TNotifyEvent read FOnChange write FOnChange;
|
property OnChange : TNotifyEvent read FOnChange write FOnChange;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
@ -1022,6 +1034,10 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.13 2002/01/03 21:17:08 lazarus
|
||||||
|
added column visible and autosize settings.
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.12 2001/12/31 22:43:00 lazarus
|
Revision 1.12 2001/12/31 22:43:00 lazarus
|
||||||
Added a TViewColumn editor to be used in the object inspector as TViewColumn's property editor.
|
Added a TViewColumn editor to be used in the object inspector as TViewColumn's property editor.
|
||||||
Shane
|
Shane
|
||||||
|
|||||||
@ -6,6 +6,10 @@ begin
|
|||||||
FAlignment :=caLeft;
|
FAlignment :=caLeft;
|
||||||
FCaption := '';
|
FCaption := '';
|
||||||
FWidth := 50;
|
FWidth := 50;
|
||||||
|
FVisible := True;
|
||||||
|
FMinWidth := 0;
|
||||||
|
FMaxWidth := 0;
|
||||||
|
FAutoSize := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TViewColumn.Destroy;
|
destructor TViewColumn.Destroy;
|
||||||
@ -40,3 +44,41 @@ begin
|
|||||||
OnChange(self);
|
OnChange(self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TViewColumn.SetMaxWidth(const AValue: Integer);
|
||||||
|
begin
|
||||||
|
if FMaxWidth = AValue then Exit;
|
||||||
|
|
||||||
|
FMaxWidth := AValue;
|
||||||
|
if Assigned(OnChange) then
|
||||||
|
OnChange(self);
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TViewColumn.SetMinWidth(const AValue: Integer);
|
||||||
|
begin
|
||||||
|
if FMinWidth = AValue then Exit;
|
||||||
|
|
||||||
|
FMinWidth := AValue;
|
||||||
|
if Assigned(OnChange) then
|
||||||
|
OnChange(self);
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TViewColumn.SetAutoSize(const AValue: Boolean);
|
||||||
|
begin
|
||||||
|
if FAutoSize = AValue then Exit;
|
||||||
|
|
||||||
|
FAutoSize := AValue;
|
||||||
|
if Assigned(OnChange) then
|
||||||
|
OnChange(self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TViewColumn.SetVisible(const AValue: Boolean);
|
||||||
|
begin
|
||||||
|
if FVisible = AValue then Exit;
|
||||||
|
|
||||||
|
FVisible := AValue;
|
||||||
|
if Assigned(OnChange) then
|
||||||
|
OnChange(self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|||||||
@ -3148,6 +3148,16 @@ begin
|
|||||||
|
|
||||||
//set column alignment
|
//set column alignment
|
||||||
gtk_clist_set_column_justification(PgtkCList(Handle),I,aGTKJUSTIFICATION[Columns.Item[i].Alignment]);
|
gtk_clist_set_column_justification(PgtkCList(Handle),I,aGTKJUSTIFICATION[Columns.Item[i].Alignment]);
|
||||||
|
|
||||||
|
//set width
|
||||||
|
gtk_clist_set_column_width(PgtkCList(Handle),I,Columns.Item[i].Width);
|
||||||
|
|
||||||
|
|
||||||
|
//set auto sizing
|
||||||
|
gtk_clist_set_column_auto_resize(PgtkCList(Handle),I,Columns.Item[i].AutoSize);
|
||||||
|
|
||||||
|
//set Visible
|
||||||
|
gtk_clist_set_column_visibility(PgtkCList(Handle),I,Columns.Item[i].Visible);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//sorting
|
//sorting
|
||||||
@ -3656,6 +3666,10 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.99 2002/01/03 21:17:08 lazarus
|
||||||
|
added column visible and autosize settings.
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.98 2002/01/03 15:31:27 lazarus
|
Revision 1.98 2002/01/03 15:31:27 lazarus
|
||||||
Added changes to propedit so the colum editor changes effect the TListView.
|
Added changes to propedit so the colum editor changes effect the TListView.
|
||||||
Shane
|
Shane
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user