Sign in Join
Wiki copytemporary

TTICheckListBox: what changed

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

OldNewLine
11For editing set of enumerated types. Let's assume that we have following definitions.
22
33``` Pascal
44 type
55 TMonth = (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec);
66 TMonths = set of TMonth;
77 //
88 TForm1 = class(TForm)
99 private
1010 FMonths: TMonths;
1111 published
1212 property Months: TMonths read FMonths write FMonths;
1313 end;
1414```
1515
1616Properties of TTICheckListBox.Link can be assigned as following way.
1717
1818``` Pascal
1919 with TICheckListBox1.LInk do begin
2020 TIObject:= Form1;
2121 TIPropertyName := 'Months';
2222 end;
2323```
2424
2525Assigning TTICheckListBox.Link.AliasValues will change displayed string of items. So, if defined in following way,
2626
2727``` Pascal
2828 with TICheckListBox1.LInk do begin
2929 with AliasValues do begin
3030 Clear;
3131 Add('Jan=January');
3232 Add('Feb=February');
3333 Add('Mar=March');
3434 Add('Apr=April');
3535 Add('Nov=November');
3636 Add('Dec=December');
3737 end;
3838 TIObject:= Form1;
3939 TIPropertyName := 'Months';
4040 end;
4141```
4242
4343The checklist items will be displayed in following way and order:
4444
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-`    `
45+```text
46+ January
47+ February
48+ March
49+ April
50+ November
51+ December
52+ May
53+ Jun
54+ Jul
55+ Aug
56+ Sep
57+ Oct
58+```
5859
5960The "checked" months will be correctly stored in the FMonths field of Form1. That is, if you ckeck November, then
6061
6162``` Pascal
6263 Nov in FMonths
6364```
6465
6566will return true.
6667
6768---
6869*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