the user selects on the bar "N" if he wants to color a single number or "N +" if he wants to color all numbers equal to the one selected
The user can delete the colors from the browse by pressing "X"
the colors to highlight the number (or numbers) are taken on the basis of a table, it is calculated if the number belongs to a specific decade and according to the decade there are different colors
if the user presses "N +" the procedure must search in the oBrw array for all numbers equal to the one selected but I don't know how to do it
I made this easy test but run only when it found all same numbers
test
- Code: Select all Expand view
#include "fivewin.ch"
#include "constant.ch"
#define START_OF_NUMBERS 2
#define MEM_FILE "test.ini"
FUNCTION Main()
RddSetDefault( "DBFCDX" )
SetHandleCount( 100 )
SET DATE FORMAT "dd-mm-yyyy"
SET DELETED ON
SET CENTURY ON
SET EPOCH TO year( date() ) - 20
SET MULTIPLE OFF
test()
RETURN nil
//---------------------------------------------------//
/*
Colors
*/
Function test()
local aData:= { ;
{ "17.08.2019",76,83,39,10,61,90,32,55,33,67},;
{ "20.08.2019",44, 4,25,29,66,74,36,55,73,30},;
{ "22.08.2019",89,54,42,12,10,35,24,46,35,47},;
{ "24.08.2019",30,64,38,60,55,44,49,66,11,16},;
{ "27.08.2019",68,11,16,72,80,15, 1,62,76,83},;
{ "29.08.2019",31,35,47,80, 2,72,12, 4,39,10},;
{ "31.08.2019",69,11,28,51,53,36,66,77,25,29},;
{ "03.09.2019",73,30,15,59,62,36, 6,24, 4,25}}
local oDlg,oBar
local oNumber,oPlus,oCancel
local lNumber
DEFINE DIALOG oDlg SIZE 800,400 PIXEL TRUEPIXEL RESIZABLE
DEFINE BUTTONBAR oBar OF oDlg 2015
//double click to evidence a number
DEFINE BUTTON onumber Prompt "N" OF oBar ;
TOOLTIP "number" ACTION lNumber:=.t.
//double click to evidence all number same the number select
DEFINE BUTTON oPlus Prompt "N+" OF oBar ;
TOOLTIP "number" ACTION lNumber:=.f.
//clear the number evidence
DEFINE BUTTON oCancel Prompt "X" OF oBar ;
TOOLTIP "number" ACTION clear()
@ 30,05 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
COLUMNS {1,2,3,4,5,6,7,8,9,10,11} ;
HEADERS {"Date","1","2","3","4","5","1","2","3","4","5"} ;
ARRAY aData LINES CELL fastedit ;
on dblclick Evidence(lNumber,oBrw) //Specivalue(oBrw)
// Evidence(lNumber,oBrw)
WITH OBJECT oBrw
:nMarqueeStyle := 2
FOR i := 2 TO LEN(:aCols)
oCol := :aCols[ i ]
oCol:nWidth := 17
NEXT
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
return nil
Function Clear();Return nil
//----------------------------------------------//
Function Evidence(lNumber,oBrw)
local nrow:= oBrw:nArrayAt
local nColNo := oBrw:SelectedCol():nCreationOrder
local nNumber:= oBrw:aArrayData[ nrow ][ nColNo ]
local nDecina:= CalC_Decina(nNumber)
local nBack,nGradient,nText
local i
Do case
Case nDecina=1
nBack :="#A9A9A9"
nGradient:="#696969"
nText :="#FFFFFF"
Case nDecina=2
nBack :="#FF0000"
nGradient:="#D93737"
nText :="#FFFFFF"
Case nDecina=3
nBack :="#FF4848"
nGradient:="#D93737"
nText :="#FFFFFF"
Case nDecina=4
nBack :="#FF6F6F"
nGradient:="#FB5200"
nText :="#FFFFFF"
Case nDecina=5
nBack :="#32CD32"
nGradient:="#008000"
nText :="#FFFFFF"
Case nDecina=6
nBack :="#66B9CE"
nGradient:="#548DD4"
nText :="#FFFFFF"
Case nDecina=7
nBack :="#548DD4"
nGradient:="#31859B"
nText :="#FFFFFF"
Case nDecina=8
nBack :="#31859B"
nGradient:="#366092"
nText :="#FFFFFF"
Case nDecina=9
nBack :="#FF00FF"
nGradient:="#BA55D3"
nText :="#FFFFFF"
endcase
nGradient := nRGB( nGradient )
nBack := nRGB( nBack )
nText := nRGB(nText )
IF lNumber
//one number
for i= 2 to Len( oBrw:aCols)
* ShowOneNumber(i,nNumber,oBrw,nBack )
NEXT
else
//all same numbers
for i= 2 to Len( oBrw:aCols)
ShowAllNumbers(i,nNumber,oBrw,nBack )
NEXT
Endif
oBrw:refresh()
return nil
//----------------------------------------------------------//
Function ShowAllNumbers(i,nNumber,oBrw,nBack )
local oCol := oBrw:aCols[ i ]
oCol:bClrStd := {|| IF(oCol:value =nNumber, {CLR_BLACK,nBack },{CLR_BLACK,CLR_WHITE })}
RETURN nil
//----------------------------------------------------------//
Function Calc_Decina(k)
local ck:= array(9)
local nAp,nDecina
local cstring:="Decina"
ck[1]:={1,2,3,4,5,6,7,8,9,10}
ck[2]:={11,12,13,14,15,16,17,18,19,20}
ck[3]:={21,22,23,24,25,26,27,28,29,30}
ck[4]:={31,32,33,34,35,36,37,38,39,40}
ck[5]:={41,42,43,44,45,46,47,48,49,50}
ck[6]:={51,52,53,54,55,56,57,58,59,60}
ck[7]:={61,62,63,64,65,66,67,68,69,70}
ck[8]:={71,72,73,74,75,76,77,78,79,80}
ck[9]:={81,82,83,84,85,86,87,88,89,90}
For v= 1 to 9
nAp:= AScan( ck[v], (k) )
IF nAp>0
nDecina:=v
Endif
next
return nDecina
//----------------------------------------------------------//
This test run only when it found all same numbers on all columns
Problem When I click on another number the procedure erase the oldest selection,
I wish have many numbers with different colors ( as my table color) and not erase the oldest selection as this