TTICheckListBox: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | For editing set of enumerated types. Let's assume that we have following definitions. | |
| 2 | 2 | ||
| 3 | 3 | ``` Pascal | |
| 4 | 4 | type | |
| 5 | 5 | TMonth = (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec); | |
| 6 | 6 | TMonths = set of TMonth; | |
| 7 | 7 | // | |
| 8 | 8 | TForm1 = class(TForm) | |
| 9 | 9 | private | |
| 10 | 10 | FMonths: TMonths; | |
| 11 | 11 | published | |
| 12 | 12 | property Months: TMonths read FMonths write FMonths; | |
| 13 | 13 | end; | |
| 14 | 14 | ``` | |
| 15 | 15 | ||
| 16 | 16 | Properties of TTICheckListBox.Link can be assigned as following way. | |
| 17 | 17 | ||
| 18 | 18 | ``` Pascal | |
| 19 | 19 | with TICheckListBox1.LInk do begin | |
| 20 | 20 | TIObject:= Form1; | |
| 21 | 21 | TIPropertyName := 'Months'; | |
| 22 | 22 | end; | |
| 23 | 23 | ``` | |
| 24 | 24 | ||
| 25 | 25 | Assigning TTICheckListBox.Link.AliasValues will change displayed string of items. So, if defined in following way, | |
| 26 | 26 | ||
| 27 | 27 | ``` Pascal | |
| 28 | 28 | with TICheckListBox1.LInk do begin | |
| 29 | 29 | with AliasValues do begin | |
| 30 | 30 | Clear; | |
| 31 | 31 | Add('Jan=January'); | |
| 32 | 32 | Add('Feb=February'); | |
| 33 | 33 | Add('Mar=March'); | |
| 34 | 34 | Add('Apr=April'); | |
| 35 | 35 | Add('Nov=November'); | |
| 36 | 36 | Add('Dec=December'); | |
| 37 | 37 | end; | |
| 38 | 38 | TIObject:= Form1; | |
| 39 | 39 | TIPropertyName := 'Months'; | |
| 40 | 40 | end; | |
| 41 | 41 | ``` | |
| 42 | 42 | ||
| 43 | 43 | The checklist items will be displayed in following way and order: | |
| 44 | 44 | ||
| 45 | - | ||
| 46 | - | ||
| 47 | - | ||
| 48 | - | ||
| 49 | - | ||
| 50 | - | ||
| 51 | - | ||
| 52 | - | ||
| 53 | - | ||
| 54 | - | ||
| 55 | - | ||
| 56 | - | ||
| 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 | + | ``` | |
| 58 | 59 | ||
| 59 | 60 | The "checked" months will be correctly stored in the FMonths field of Form1. That is, if you ckeck November, then | |
| 60 | 61 | ||
| 61 | 62 | ``` Pascal | |
| 62 | 63 | Nov in FMonths | |
| 63 | 64 | ``` | |
| 64 | 65 | ||
| 65 | 66 | will return true. | |
| 66 | 67 | ||
| 67 | 68 | --- | |
| 68 | 69 | *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).* |
