Sign in Join
Wiki copytemporary

TTICheckListBox: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: TTICheckListBox

OldNewLine
1+For editing set of enumerated types. Let's assume that we have following definitions.
2+
3+``` Pascal
4+ type
5+ TMonth = (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec);
6+ TMonths = set of TMonth;
7+ //
8+ TForm1 = class(TForm)
9+ private
10+ FMonths: TMonths;
11+ published
12+ property Months: TMonths read FMonths write FMonths;
13+ end;
14+```
15+
16+Properties of TTICheckListBox.Link can be assigned as following way.
17+
18+``` Pascal
19+ with TICheckListBox1.LInk do begin
20+ TIObject:= Form1;
21+ TIPropertyName := 'Months';
22+ end;
23+```
24+
25+Assigning TTICheckListBox.Link.AliasValues will change displayed string of items. So, if defined in following way,
26+
27+``` Pascal
28+ with TICheckListBox1.LInk do begin
29+ with AliasValues do begin
30+ Clear;
31+ Add('Jan=January');
32+ Add('Feb=February');
33+ Add('Mar=March');
34+ Add('Apr=April');
35+ Add('Nov=November');
36+ Add('Dec=December');
37+ end;
38+ TIObject:= Form1;
39+ TIPropertyName := 'Months';
40+ end;
41+```
42+
43+The checklist items will be displayed in following way and order:
44+
45+`    January`\
46+`    February`\
47+`    March`\
48+`    April`\
49+`    November`\
50+`    December `\
51+`    May`\
52+`    Jun`\
53+`    Jul`\
54+`    Aug`\
55+`    Sep`\
56+`    Oct`\
57+`    `
58+
59+The "checked" months will be correctly stored in the FMonths field of Form1. That is, if you ckeck November, then
60+
61+``` Pascal
62+ Nov in FMonths
63+```
64+
65+will return true.
66+
67+---
68+*From the Free Pascal wiki, page "TTICheckListBox", as it stood on 2022-04-02 after a change by Alextpp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history