-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathqFavorites.pas
More file actions
90 lines (79 loc) · 2.09 KB
/
qFavorites.pas
File metadata and controls
90 lines (79 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
unit qFavorites;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ElTree;
type
TChanList = class(TForm)
AddBtn: TButton;
EditBtn: TButton;
DeleteBtn: TButton;
SortBtn: TButton;
CloseBtn: TButton;
Chans: TElTree;
procedure AddBtnClick(Sender: TObject);
procedure CloseBtnClick(Sender: TObject);
procedure EditBtnClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
ChanList: TChanList;
implementation
{$R *.DFM}
procedure TChanList.AddBtnClick(Sender: TObject);
var
Str1 : String;
Str2 : String;
X : Integer;
DeItem : TELTreeItem;
begin
Str1 := InputBox('Adding a channel', 'Please enter a channel, space,'#13#10' and then a description of it:', '');
If (Str1 <> '') Then
Begin
X := Pos(' ', Str1);
If (X <> 0) Then
Begin
Str2 := Copy(Str1, X + 1, MaxInt);
Delete(Str1, X, MaxInt);
End;
If (Copy(Str1, 1, 1) <> '#') Then
Str1 := '#' + Str1;
DeItem := Chans.Items.AddItem(DeItem);
// DeItem.Text := Trim(Str1);
// DeItem.ColumnText.Add(Str2);
End;
end;
procedure TChanList.CloseBtnClick(Sender: TObject);
begin
Self.Release;
end;
procedure TChanList.EditBtnClick(Sender: TObject);
var
Str1 : String;
Str2 : String;
X : Integer;
DeItem : TELTreeItem;
begin
DeItem := Chans.Selected;
Str1 := DeItem.Text;
Str2 := DeItem.ColumnText.Strings[0];
Str1 := InputBox('Editing a channel', 'You may change the channel name and description here:', Str1 + ' ' + Str2);
If (Str1 <> '') Then
Begin
X := Pos(' ', Str1);
If (X <> 0) Then
Begin
Str2 := Copy(Str1, X + 1, MaxInt);
Delete(Str1, X, MaxInt);
End;
If (Copy(Str1, 1, 1) <> '#') Then
Str1 := '#' + Str1;
DeItem := Chans.Items.AddItem(DeItem);
DeItem.Text := Trim(Str1);
DeItem.ColumnText.Add(Str2);
End;
end;
end.