forked from pyscripter/pyscripter
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdlgPickList.pas
89 lines (77 loc) · 2.19 KB
/
dlgPickList.pas
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
{-----------------------------------------------------------------------------
Unit Name: dlgPickList
Author: Kiriakos Vlahos
Date: 10-Mar-2006
Purpose: Generic Pick List dialog
History:
-----------------------------------------------------------------------------}
unit dlgPickList;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls, CheckLst, Menus, SpTBXControls,
SpTBXEditors, dlgPyIDEBase, SpTBXItem;
type
TPickListDialog = class(TPyIDEDlgBase)
PickListPopUp: TPopupMenu;
mnSelectAll: TMenuItem;
mnDeselectAll: TMenuItem;
imgIcon: TImage;
lbMessage: TSpTBXLabel;
CheckListBox: TSpTBXCheckListBox;
Panel2: TSpTBXPanel;
Bevel1: TBevel;
btnSelectAll: TSpTBXButton;
btnDeselectAll: TSpTBXButton;
btnOk: TSpTBXButton;
btnCancel: TSpTBXButton;
SpTBXPanel1: TSpTBXPanel;
procedure mnDeselectAllClick(Sender: TObject);
procedure mnSelectAllClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure SetScrollWidth;
end;
var
PickListDialog: TPickListDialog;
implementation
uses dmCommands, Math;
{$R *.dfm}
procedure TPickListDialog.mnSelectAllClick(Sender: TObject);
var
i : integer;
begin
for i := 0 to CheckListBox.Items.Count - 1 do
CheckListBox.Checked[i] := True;
end;
procedure TPickListDialog.SetScrollWidth;
var
i: integer;
ItemMaxWidth: integer;
begin
ItemMaxWidth := 0;
with CheckListBox do
begin
// Calculate the Max Length
for i := 0 to CheckListBox.Items.Count - 1 do
ItemMaxWidth := Max(CheckListBox.Canvas.TextWidth(CheckListBox.Items[i]),
ItemMaxWidth);
ScrollWidth := ItemMaxWidth + 5;
end;
end;
procedure TPickListDialog.FormCreate(Sender: TObject);
begin
inherited;
imgIcon.Picture.Icon.Handle := LoadIcon(0, IDI_INFORMATION);
end;
procedure TPickListDialog.mnDeselectAllClick(Sender: TObject);
var
i : integer;
begin
for i := 0 to CheckListBox.Items.Count - 1 do
CheckListBox.Checked[i] := False;
end;
end.