Forum > Beginners

Grid and RichMemo

(1/1)

ariben:
Hi All,

Thank you very much for your reply to my former question.

On this time I would like ask about Grid and RichMemo

I have a Grid which has search result from a database. On clicking the cell in the Grid, the content
 of the cell is displayed in the Richmemo box. This works fine. Then I want to highlight the hit term
(making them red and bold) in the Richmemo.

I have just begun to crawl. So see here is also welcome.

Fibonacci:
I have this code snippet, maybe you will find it useful. LogMemo is TRichEdit.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TMainForm.Log(Item: string; ItemColor:TColor=clBlack);var i1, i2, i3 : integer; Date : string;begin i1 := Length(LogMemo.Lines.Text); Date := DateTimeToStr(now)+' | '; i2 := i1 + Length(Date); LogMemo.Lines.Add(Date+Item); i3 := Length(LogMemo.Lines.Text); LogMemo.SelStart := i1; LogMemo.SelLength := i2-i1; LogMemo.SelAttributes.Color := clblack; LogMemo.SelStart := i2; LogMemo.SelLength := i3-i2; LogMemo.SelAttributes.Color := ItemColor; LogMemo.SelStart := i3; SendMessage(LogMemo.Handle,WM_VScroll,SB_LINEDOWN,0);end;

ariben:
Thank you very much, Fibonacci. Your code helped me a lot. Now I'm done!

Navigation

[0] Message Index

Go to full version