Code: Select all
browsedata := {|| field->mystring}
cHeader := ....
cAlias :=
@2.5, 1 DCBROWSE oBrowse SIZE 40, 20 ;
DATA cAlias ;
CURSORMODE XBPBRW_CURSOR_ROW ;
FIT ;
SUBCLASS 'XbpBrowseHighlight()' ;
EVAL {|o| o:UseVisualStyle:=.F.} ;
TABSTOP
DCBROWSECOL DATA browsedata HEADER cHeader WIDTH 80 PARENT oBrowse EVAL {|o| o:DataArea:DrawMode := XBP_DRAW_OWNER}
.....
***************************************
Class XbpBrowseHighlight from DC_XbpBrowse
***************************************
Protected:
Var cHighlight
Exported:
Inline Method destroy()
*********************
::cHighlight := NIL
::DC_XbpBrowse:Destroy()
Return (Self)
Inline Method init(oParent, oOwner, aPos, aSize, aPP, lVisible, oGetList)
*****************************************************************
::DC_XbpBrowse:Init(oParent, oOwner, aPos, aSize, aPP, lVisible, oGetList)
::DrawMode := XBP_DRAW_OWNER
::cHighlight := ''
Return (Self)
Inline Method create(oParent, oOwner, aPos, aSize, aPP, lVisible)
*******************************************************************
::DC_XbpBrowse:Create(oParent, oOwner, aPos, aSize, aPP, lVisible)
Return (Self)
Inline Method customDrawCell(oPS, aInfo)
******************************************
LOCAL xData, nPos, aRect, cSubstr
xData := aInfo[XBP_DRAWINFO_AREA]:GetCell(aInfo[XBP_DRAWINFO_ITEM])
if xData <> NIL .and. (nPos := At(::cHighlight, upper(xData))) > 0
cSubStr := substr(xData, nPos, len(::cHighlight))
oPS:SetColor(iif(aInfo[XBP_DRAWINFO_STATE] == XBP_DRAWSTATE_SELECTED, XBPSYSCLR_MENUHILITE, XBPSYSCLR_WINDOWSTATICTEXT))
GraCaptionStr(oPS, aInfo[XBP_DRAWINFO_RECT], {aInfo[XBP_DRAWINFO_RECT, 3], aInfo[XBP_DRAWINFO_RECT, 4]}, xData)
oPS:SetColor(GRA_CLR_BLUE)
if nPos == 1
GraCaptionStr(oPS, aInfo[XBP_DRAWINFO_RECT], {aInfo[XBP_DRAWINFO_RECT, 3], aInfo[XBP_DRAWINFO_RECT, 4]}, cSubStr)
else
aRect := GraQueryTextBox(oPS, left(xData, nPos - 1))
GraCaptionStr(oPS, {aInfo[XBP_DRAWINFO_RECT, 1] + aRect[3, 1], aInfo[XBP_DRAWINFO_RECT, 2]}, {aInfo[XBP_DRAWINFO_RECT, 3], aInfo[XBP_DRAWINFO_RECT, 4]}, cSubstr)
endif
Return (.F.)
endif
Return (.T.)
Inline Method highlight(cStr)
*******************************
::cHighlight := cStr
::InvalidateRect()
Return (Self)
EndClass