Cristobal,
maybe it is possible to include the logic from Richedit-hightlight method
We have to scan each line for the keyword(s)
The return-values of the included messages are ok but the colouring of the area doesn't work
:bChange聽:= { || cTKeyWord1 := UPPER(ALLTRIM((cFileName)->INFO1)), ;
聽 聽cTKeyWord2 := UPPER(ALLTRIM((cFileName)->INFO2)), ;
聽 聽cTopic := ALLTRIM((cFileName)->TOPIC), ;
聽 聽oTopic:SetText( cTopic ), ;
聽 聽SHOW_KEYW( oTopic, cTopic, cTKeyWord1, cTKeyWord2 ), ;
聽 聽cTCode := (cFileName)->CODE, ;
聽 聽oTCode:SetText( cTCode ), ;
聽 聽SHOW_KEYW( oTCode, cTCode, cTKeyWord1, cTKeyWord2 ), ;聽聽 聽 聽 聽 聽 聽 聽 聽 聽
聽 聽TCode:GoToLine( 1 ) }
...
...
// ----------------- Check each line -----------
FUNCTION SHOW_KEYW( oCode, cCode, cKeyWord1, cKeyWord2 )
LOCAL nPos := 20, nLen := 50, nLine
FOR nLine := 1 to oCode:GetLineCount() // 聽Scan line by line
聽 聽 聽 聽THIGHLIGHT( nLine, oCode, cCode, cKeyWord1, cKeyWord2 )
聽 聽 聽 聽SysRefresh()
NEXT
RETURN NIL
// ----------------- Keyword hightlight ----------
FUNCTION THIGHLIGHT( nLine, oCode, cCode, cKeyWord1, cKeyWord2 )
local cLine聽:= ""
local nAt聽 聽:= 1
local nAt1聽 := 0
local nAt2聽 := 0
local nSep := 0
local nLen聽 := 0
local nGetSel := oCode:SendMsg( EM_GETSEL )
oCode:aKeywords1 聽= { cKeyWord1, cKeyWord2 }
oCode:GoTo( nLine )
oCode:SendMsg( 11, 0, 0 )
// review keywords in current line to highlight them
cLine = StrTran( oCode:GetLine( nLine ), Chr( 13 ), "" ) // result cLine = Linetext
nLen = Len( cLine )
nAt1 := AT( cKeyWord1, UPPER(cLine) ) 聽
nAt2 := AT( cKeyWord2, UPPER(cLine) ) 聽
IF nAt1 > 0
聽 聽 MsgAlert( cLine, "Line" + " 聽->> " + ALLTRIM( STR(nLine)) )
聽 聽 MsgAlert( nAt1, "Left 1" )
聽 聽 MsgAlert( LEN( cKeyWord1 ), "Len Keyword 1" )
聽 聽 oCode:Colorize( nAt1, LEN( cKeyWord1 ), 255 )
ENDIF
IF nAt2 > 0
聽 聽 MsgAlert( cLine, "Line" + " 聽->> " + ALLTRIM( STR(nLine)) )
聽 聽 MsgAlert( nAt2, "Left 2" )
聽 聽 MsgAlert( LEN( cKeyWord2 ), "Len Keyword 2" )
聽 聽 oCode:Colorize( nAt2, LEN( cKeyWord2 ), 255 )
ENDIF
// Let the control be painted
oCode:SendMsg( 11, 1, 0 )
InvalidateRect( oCode:hWnd )
RETURN NIL
regards
Uwe
