Difference between revisions of "Talk:RichMemo"

From Free Pascal wiki
Jump to navigationJump to search
Line 8: Line 8:
 
: I moved it back (I guess I overlooked the /ru page). - [[User:Arent|Arent]] ([[User talk:Arent|talk]]) 12:35, 29 July 2016 (CEST)
 
: I moved it back (I guess I overlooked the /ru page). - [[User:Arent|Arent]] ([[User talk:Arent|talk]]) 12:35, 29 July 2016 (CEST)
 
:: Thanks! Why did you rename it in the first place? [[User:Skalogryz|Skalogryz]] ([[User talk:Skalogryz|talk]]) 14:10, 29 July 2016 (CEST)
 
:: Thanks! Why did you rename it in the first place? [[User:Skalogryz|Skalogryz]] ([[User talk:Skalogryz|talk]]) 14:10, 29 July 2016 (CEST)
 +
==Todo SetParaTabs==
 +
Add more examples and descriptions about TabStops
 +
<source lang="delphi">
 +
procedure InitTabStopWithWidth(out lst: TTabstopList; width: double);
 +
const
 +
  ReasonableCount = 12;
 +
var
 +
  i : integer;
 +
begin
 +
  lst.Count:=ReasonableCount;
 +
  SetLength(lst.Tabs, ReasonableCount);
 +
  for i:=0 to ReasonableCount-1 do
 +
    lst.Tabs[i].Offset:=width*i;
 +
end;
 +
 +
procedure TForm1.FormShow(Sender: TObject);
 +
var
 +
  w : double;
 +
  lst : TTabStopList;
 +
begin
 +
  Canvas.Font.Name:='Courier New'; // RichMemo1.Font.Name
 +
  Canvas.Font.Size:=10;            // RichMemo1.Font.Size
 +
  w:=Canvas.TextWidth('w')/96*72;  // should be mono-width anyway
 +
  InitTabStopWithWidth(lst, w*8);
 +
 +
  RichMemo1.HandleNeeded;
 +
  RichMemo1.SetParaTabs (0,-1, lst);
 +
end; 
 +
</source>

Revision as of 18:15, 7 March 2017

Page Renaming

Arent. Recently you moved RichMemo to TRichMemo. Not sure why this occurred and what's the reason for it (is there a page that disclose the requirement?), but Russian page was not moved and now it is lost (from user interface!).

Here's a consideration for renaming. While the visual component itself is indeed named TRichMemo, the package is named RichMemo. It includes a little bit more than just TRichMemo component. For example it contains TCustomRichMemo, that is used as a base for a separate package TDBRichMemo!

Thus I'm thinking that the page should named after the package name rather than component name.

I moved it back (I guess I overlooked the /ru page). - Arent (talk) 12:35, 29 July 2016 (CEST)
Thanks! Why did you rename it in the first place? Skalogryz (talk) 14:10, 29 July 2016 (CEST)

Todo SetParaTabs

Add more examples and descriptions about TabStops

procedure InitTabStopWithWidth(out lst: TTabstopList; width: double);
const
  ReasonableCount = 12;
var
  i : integer;
begin
  lst.Count:=ReasonableCount;
  SetLength(lst.Tabs, ReasonableCount);
  for i:=0 to ReasonableCount-1 do
    lst.Tabs[i].Offset:=width*i;
end;

procedure TForm1.FormShow(Sender: TObject);
var
  w : double;
  lst : TTabStopList;
begin
  Canvas.Font.Name:='Courier New'; // RichMemo1.Font.Name
  Canvas.Font.Size:=10;            // RichMemo1.Font.Size
  w:=Canvas.TextWidth('w')/96*72;  // should be mono-width anyway
  InitTabStopWithWidth(lst, w*8);

  RichMemo1.HandleNeeded;
  RichMemo1.SetParaTabs (0,-1, lst);
end;