nageswaragunupudi wrote:I am giving a very simple sample.
You may adopt this logic to your situation.
- Code: Select all Expand view
function BrwColorCells()
local oDlg, oFont, oBrw, oCol
local aPos := { { 1, 2 }, { 1, 4 }, { 2, 1 }, { 3, 3 }, { 4, 2 }, { 4, 4 } }
local aData := ;
{ { 11, 12, 13, 14 } ;
, { 21, 22, 23, 24 } ;
, { 31, 32, 33, 34 } ;
, { 41, 42, 43, 44 } }
XBROWSER aPos TITLE "HIGHLIGHT CELLS" SETUP oBrw:cHeaders := { "ROW", "COL" }
DEFINE FONT oFont NAME "VERDANA" SIZE 0,-20 BOLD
DEFINE DIALOG oDlg SIZE 400,250 PIXEL TRUEPIXEL FONT oFont
@ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE aData AUTOCOLS LINES NOBORDER
for each oCol in oBrw:aCols
oCol:bClrStd := GenClrBlock( oCol, aPos )
next
oBrw:cHeaders := { "1", "2", "3", "4" }
oBrw:nWidths := "9999"
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
//----------------------------------------------------------------------------//
static function GenClrBlock( oCol, aPos )
local oBrw := oCol:oBrw
local nCol := oCol:nCreationOrder
local xCol
xCol := nCol // your calculation
return { || If( AScan( aPos, { |a| a[ 1 ] == oBrw:nArrayAt .and. a[ 2 ] == xCol } ) > 0, ;
{ CLR_WHITE, CLR_BLUE }, { CLR_BLACK, CLR_WHITE } ) }
//----------------------------------------------------------------------------//
Please run this program as it is without changes.
And then adopt the GenClrBlock(...) to your requirements (particularly deriving xCol from nCol )
Thanks Rao
your test run ok
but I have specific coordinates and I wanted to translate the position also in other columns that are not described in the array
for example to explain to you in the xbrowse I have three groups (extracts, delays, frequencies)
if in the array I have the number 55 and the calculation gives me the coordinate
nRow = 1
nCol = 3
in the array I have {1, 3}
I want to color in row 1:
the first column
column 3 (Extracted Numbers group)
column 9 (column 3 of the Delays group)
column 14 of the group (column 3 frequencies)
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com