Cristobal,
I did some changes to the sample
because of a colored dialog You can see that the memo gets repainted again and again
With my changes the memo is painted only once and after that a text replacement.
Maybe You can have a look at it
#include "FiveWin.ch"
#include "RichEdi5.ch"
Static oDlg, oBrw, oMemo
FUNCTION MAIN()
local cTitle:="Test"
local cResult, cText
local oFont, oBold, oBrush
local oSay, cFilter := "FiveWin"
REQUEST DBFCDX
USE clients via "DBFCDX" NEW
cText 聽 := clients->notes
DEFINE FONT oFont NAME "Courier New" SIZE 8,15
DEFINE FONT oBold NAME "Courier New" BOLD SIZE 8,15
DEFINE BRUSH oBrush COLOR 16763283
DEFINE DIALOG oDlg FROM 5,10 TO 50, 170 font oFont TITLE "Test Color"
@ 10, 10 XBROWSE oBrw OF oDlg ;
聽 聽 聽 SIZE 350, 200 PIXEL ;
聽 聽 聽 COLUMNS 'Name', 'Adress', 'Notes' ;
聽 聽 聽 ALIAS 'CLIENTS' NOBORDER
WITH OBJECT oBrw
聽 聽 聽 :nColDividerStyle := LINESTYLE_LIGHTGRAY
聽 聽 聽 :nRowDividerStyle := LINESTYLE_LIGHTGRAY
聽 聽 聽 :bClrRowFocus 聽 聽 := { || { CLR_BLACK, RGB(185,220,255) } }
聽 聽 聽 :nMarqueeStyle 聽 聽:= MARQSTYLE_HIGHLROWMS
聽 聽 聽 :bChange := { ||聽 oSay:refresh(), ;
聽 聽 聽 聽 聽 聽 聽 聽 cText := clients->notes, oMemo:SetText( cText ), ;
聽 聽 聽 聽 聽 聽 聽 聽 oMemo:LoadRTF( SHOWMEMO(cText, cFilter), .F. ), ;
聽 聽 聽 聽 聽 聽 聽 聽 oMemo:GoToLine( 1 ) }
聽 聽 聽 :CreateFromCode()
END
@ 10, 370 SAY oSay PROMPT clients->notes SIZE 200, 80 PIXEL OF oDlg COLOR CLR_BLACK update 聽//TRANSPARENT
@ 120,370 RICHEDIT5 oMemo VAR cText of oDlg PIXEL SIZE 250, 200
ACTIVATE DIALOG oDlg CENTERED ON INIT ;
( oDlg:SetBrush( oBrush ), ;
聽 oMemo:SetText( cText ), ;
聽 oMemo:LoadRTF( SHOWMEMO(cText, cFilter), .F. ), ;
聽 oMemo:GoToLine( 1 ) )
RELEASE BRUSH oBrush
CLOSE ALL
RETURN NIL
//----------------------
FUNCTION SHOWMEMO(cText, cFilter)
Local cStr 聽 聽 := ""
local cInto 聽 聽:= "\highlight1" + cFilter + "\highlight0" 聽// Put Word in Color
local cVar 聽 聽 := ""
cStr 聽 聽+= "{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang3082{\fonttbl{\f0\fnil\fcharset0 Tahoma;}}"
cStr 聽 聽+= "{\colortbl ;\red255\green0\blue0;\red0\green0\blue0;\red128\green64\blue64;\red0\green0\blue128;}"
cStr 聽 聽+= "\viewkind4\uc1"
cStr 聽 聽+= "\pard\fs20" + if( Empty( cText ), " ", cText )
cStr 聽 聽+= "}"
cStr 聽 聽:= StrTran( cStr, cFilter, cInto ) // 聽Word that we will look for
RETURN cStr
regards
Uwe
