RichMemo/Samples: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | ## Tabs | |
| 2 | 2 | ||
| 3 | 3 | Tabs are used to organize the text in table-like layout. This would not be a real layout table, but will make the text (if it's short enough) to look table alike. | |
| 4 | 4 | ||
| 5 | 5 | ### Basics | |
| 6 | 6 | ||
| 7 | 7 | In order for tabs to work the text should be split tab character (#9) | |
| 8 | 8 | ||
| 9 | 9 | This is how the text would look like if no tab separation is used: | |
| 10 | 10 | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 11 | + |  | |
| 15 | 12 | ||
| 16 | 13 | ```delphi | |
| 17 | 14 | RichMemo1.Lines.Add('hello world'); | |
| 18 | 15 | RichMemo1.Lines.Add('this sample'); | |
| 19 | 16 | ``` | |
| 20 | 17 | ||
| 21 | 18 | If the words are split by Tabs, then the control tries to find the next proper tab offset in order: | |
| 22 | 19 | ||
| 23 | - | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - | ||
| 20 | + |  | |
| 27 | 21 | ||
| 28 | 22 | ```delphi | |
| 29 | 23 | RichMemo1.Lines.Add('hello'#9'world'); | |
| 30 | 24 | RichMemo1.Lines.Add('this'+#9+'sample'); | |
| 31 | 25 | ``` | |
| 32 | 26 | ||
| 33 | 27 | ### Tab Offsets | |
| 34 | 28 | ||
| 35 | 29 | The length of tab offsets can be controlled using [[RichMemo|GetParaTabs]] and [[RichMemo|SetParaTabs]] methods. | |
| 36 | 30 | ||
| 37 | 31 | ```delphi | |
| 38 | 32 | var | |
| 39 | 33 | st : TTabStopList; | |
| 40 | 34 | i : integer; | |
| 41 | 35 | begin | |
| 42 | 36 | ||
| 43 | 37 | RichMemo1.GetParaTabs(0, st); // getting the current tabs | |
| 44 | 38 | st.Count:=8; | |
| 45 | 39 | SetLength(st.Tabs, st.Count); | |
| 46 | 40 | for i:=0 to length(st.Tabs)-1 do | |
| 47 | 41 | st.Tabs[i].Offset:=i*72; | |
| 48 | 42 | RichMemo1.SetParaTabs(-1,-1,st); // assigning tabs stops | |
| 49 | 43 | ||
| 50 | 44 | // assigning text with tabs (#9) | |
| 51 | 45 | RichMemo1.Lines.Add('hello'#9'world'#9'to'#9'columns'); | |
| 52 | 46 | RichMemo1.Lines.Add('does'#9'it'#9'look'#9'good'#9'?'); | |
| 53 | 47 | RichMemo1.Lines.Add('tab'+#9+'is'+#9+'character'+#9+'9'); | |
| 54 | 48 | end; | |
| 55 | 49 | ``` | |
| 56 | 50 | ||
| 57 | - | ||
| 58 | - | ||
| 59 | - | ||
| 60 | - | ||
| 51 | + |  | |
| 61 | 52 | ||
| 62 | 53 | ## See Also | |
| 63 | 54 | ||
| 64 | 55 | - [[RichMemo]] | |
| 65 | 56 | ||
| 66 | 57 | --- | |
| 67 | 58 | *From the Free Pascal wiki, page "RichMemo/Samples", as it stood on 2021-06-28 after a change by Skalogryz, 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).* | |
| 68 | 59 | Category: RichMemo |
