Great Uwe,
Here i have a code that I have working to highlight a word in a memo field and a browse.
Put this in the samples dir and compile.
Now it is hardcoded to look and change "FiveWin", but it works.
Keep in mind that this code is simple, not uptimised, and not programmed like the guys here. )))
It can put you on a starting point..
- Code: Select all Expand view
#include "FiveWin.ch"
#include "RichEdit.ch"
function Main()
local cTitle:="Test"
local cResult, oMemo
Public cShowstr:=""
Public oDlg
REQUEST DBFCDX
USE clients via "DBFCDX" NEW
DEFINE FONT oFont NAME "Courier New" SIZE 8,15
DEFINE FONT oBold NAME "Courier New" BOLD SIZE 8,15
DEFINE DIALOG oDlg FROM 5,10 TO 50, 200 font oFont TITLE "Test Color"
@ 10, 10 XBROWSE oBrw OF oDlg ;
SIZE 400, 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(),showmemo() }
:CreateFromCode()
END
@ 10,460 SAY oSay PROMPT clients->notes SIZE 200,200 PIXEL OF oDlg COLOR CLR_BLACK update //TRANSPARENT
ACTIVATE DIALOG oDlg CENTERED
close all
Return nil
function showmemo()
Local cStr:=""
local cChange:= "FiveWin" // Word that we will look for
local cInto:= "\cf2 FiveWin \cf1" // Put Word in Color
cText = alltrim(clients->notes)
cStr += "{\rtf1\ansi\deff0"
cStr += "{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}"
cstr = cStr + cText
cStr += "}"
cShowStr = StrTran( cStr, cChange, cInto ) // --> "Harbour Power"
hDLL = LoadLibrary( 'riched20.dll' )
@ 250,900 RICHEDIT oMemo VAR cShowstr of oDlg PIXEL SIZE 300,400
return NIL