mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 14:29:29 +02: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;
|
||||
btnOK : TBitBtn;
|
||||
btnCancel : TBitBtn;
|
||||
cbVisible : TCheckbox;
|
||||
cbAutoSize : TCheckBox;
|
||||
private
|
||||
{ private declarations }
|
||||
FItems : TList;
|
||||
@ -38,6 +40,8 @@ type
|
||||
procedure Listbox1OnClick(sender : TObject);
|
||||
Procedure Edit1OnChange(Sender : TObject);
|
||||
Procedure Edit2OnChange(Sender : TObject);
|
||||
Procedure cbVisibleOnClick(Sender : TObject);
|
||||
Procedure cbAutoSizeOnClick(Sender : TObject);
|
||||
Procedure FormOnShow(Sender : TObject);
|
||||
public
|
||||
{ public declarations }
|
||||
@ -61,7 +65,7 @@ Begin
|
||||
begin
|
||||
Caption := 'Column Editor';
|
||||
Width := 400;
|
||||
Height := 300;
|
||||
Height := 340;
|
||||
OnShow := @FormOnShow;
|
||||
Position := poScreenCenter;
|
||||
Listbox1 := TListBox.Create(self);
|
||||
@ -71,7 +75,7 @@ Begin
|
||||
left := 1;
|
||||
Width := 170;
|
||||
Top := 1;
|
||||
Height := 210;
|
||||
Height := 270;
|
||||
Visible := True;
|
||||
OnClick := @Listbox1OnClick;
|
||||
end;
|
||||
@ -136,14 +140,40 @@ Begin
|
||||
ItemIndex := 0;
|
||||
OnClick := @RadioGroup1OnClick;
|
||||
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);
|
||||
with Button1 do
|
||||
Begin
|
||||
Parent := self;
|
||||
Caption := 'Add';
|
||||
Left := self.width div 2;
|
||||
Top := RadioGroup1.Top+RadioGroup1.Height+5;
|
||||
Top := cbAutoSize.Top+cbAutoSize.Height+5;
|
||||
Visible := True;
|
||||
OnClick := @Button1OnClick;
|
||||
end;
|
||||
@ -340,6 +370,10 @@ begin
|
||||
caCenter:RadioGroup1.ItemIndex := 1;
|
||||
caRight : RadioGroup1.ItemIndex := 2;
|
||||
end; //case
|
||||
|
||||
cbVisible.Checked := ViewColumn.Visible;
|
||||
cbAutoSize.Checked := ViewColumn.AutoSize;
|
||||
|
||||
|
||||
FSelectedIndex := Value;
|
||||
|
||||
@ -404,6 +438,27 @@ begin
|
||||
Result := FItems.Add(ViewColumn);
|
||||
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
|
||||
{ $I columndlg.lrs}
|
||||
|
||||
|
@ -429,6 +429,14 @@ type
|
||||
FAlignment: TColumnAlignment;
|
||||
FOnChange: TNotifyEvent;
|
||||
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 SetCaption(const AValue: String);
|
||||
|
||||
@ -438,7 +446,11 @@ type
|
||||
destructor Destroy; override;
|
||||
Property Caption : String read FCaption write SetCaption;
|
||||
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 AutoSize : Boolean read FAutoSize write SetAutoSize;
|
||||
Property Visible : Boolean read FVisible write SetVisible;
|
||||
property OnChange : TNotifyEvent read FOnChange write FOnChange;
|
||||
|
||||
end;
|
||||
@ -1022,6 +1034,10 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$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
|
||||
Added a TViewColumn editor to be used in the object inspector as TViewColumn's property editor.
|
||||
Shane
|
||||
|
@ -6,6 +6,10 @@ begin
|
||||
FAlignment :=caLeft;
|
||||
FCaption := '';
|
||||
FWidth := 50;
|
||||
FVisible := True;
|
||||
FMinWidth := 0;
|
||||
FMaxWidth := 0;
|
||||
FAutoSize := False;
|
||||
end;
|
||||
|
||||
destructor TViewColumn.Destroy;
|
||||
@ -40,3 +44,41 @@ begin
|
||||
OnChange(self);
|
||||
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
|
||||
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;
|
||||
|
||||
//sorting
|
||||
@ -3656,6 +3666,10 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$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
|
||||
Added changes to propedit so the colum editor changes effect the TListView.
|
||||
Shane
|
||||
|
Loading…
Reference in New Issue
Block a user