As stated previously, my goal is to make a markdown renderer --> with some additional functionality, such as colors, and some groff/troff capacity.
So I have this code:
if (lineType = renderTarget) then
begin
showMessage('good to go - this will be a target to render');
// add line
currSection.isRendered := False; // NOT YET Rendered
// The following attributes and details need to be considered for a successful render
// #1 The Text Content
SetLength(currSection.Text,0); // TEXT ARRAY is set to empty
SetLength(currSection.Text, length(currSection.Text) + 1); // add one element
currSection.Text[length (currSection.Text) -1 ] := currLine ; // This is the current text to be rendered
// #2 The Text COLOR
if (currColor = clNone) then
begin
currSection.TextColor:= colorLabel.Color; // have set the global color
end
else
begin
currSection.TextColor:= currColor; // have set the global color
end;
// Document.DocumentTree.appendChild(currsection); // Under development
// render line
SetLength(memoList , Length(memoList) + 1); // increase size of render container by 1
memoList[length(memoList) -1 ] := TMemo.Create(self); // new memo created
memoList[length(memoList) -1].Parent := renderPanel;
memoList[length(memoList) -1].Color := currSection.TextColor; // backgroundColor
memoList[length(memoList) -1].Left := 10;
memoList[length(memoList) -1].Width := renderPanel.Width - ScrollBar2.Width - memoList[length(memoList) -1].Left ;
memoList[length(memoList) -1].Text := currSection.Text[0];
// memoList[length(memoList) -1].Height := NEED SOME MAGIC HERE
end;
I have this text:
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.I want to find out programmatically the height of the memo that is necessary so that no scrolling would be required. I looked for things like TMemo.textHeight, but can't find it by a simple googling. Please help. Thank you.