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