To Mr Nages xbrowse colors

To Mr Nages xbrowse colors

Postby Silvio.Falconi » Thu Mar 14, 2013 10:26 am

I have an array (1,3)
and i want change the color on column 3 if the data is = "Free"


olbx:bClrStd:= {|| if( acheck[oLbx:nArrayAt,3]="Free",{ CLR_GREEN, RGB(221,245,255)},{ CLR_BLACK, RGB(221,245,255) }) }

On Windows Seven run ok NO errors

On Winxp run ok but then when I select a row it make this error


Code: Select all  Expand view
Application
===========
   Path and name: C:\work\PRG\test_rooms\test.Exe (32 bits)
   Size: 2,163,712 bytes
   Compiler version: xHarbour build 1.2.1 Intl. (SimpLex) (Rev. 6715)
   FiveWin  Version: FWHX 12.03
   Windows version: 5.1, Build 2600 Service Pack 2

   Time from start: 0 hours 0 mins 43 secs
   Error occurred at: 03/14/2013, 11:57:07
   Error description: Error BASE/1068  Argument error: array access
   Args:
     [   1] = U  
     [   2] = N   3

Stack Calls
===========
   Called from: test.prg => (b)TEST( 112 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTCELL( 9646 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTDATA( 9561 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT( 1434 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY( 1253 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1666 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 11632 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3153 )




Where is the error ?
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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Mr Nages xbrowse colors

Postby ukoenig » Thu Mar 14, 2013 9:13 pm

Silvio,

Samples, showing different cell-colors of a Col, related to a filter

Sample 1

Image

Code: Select all  Expand view

function Main()
local oWnd
local oBrw
local nI

local aArray := {}

DEFINE WINDOW oWnd TITLE "Testing cell-color"

if empty( aArray )
      aArray := {{"one","two",.F.,"four"},;
            {"one","two",.T.,"four"},;
            {"one","two",.F.,"four"},;
            {"one","two",.F.,"four"}}
endif

@ 0,0 XBROWSE oBrw OF oWnd ;
      COLUMNS {1,2,3,4} ;
      HEADERS {"Col 1","Col 2","Col 3","Col 4"} ;
      array aArray LINES CELL fastedit
      oBrw:nRowHeight := 25

oBrw:aCols[3]:bClrstd := {|| { 0, TEST_VALUE(oBrw, 3, aArray) } }
   
oWnd:oClient := oBrw

oBrw:createfromcode()

activate window oWnd

RETURN NIL

// ------ DEFINE ANY FILTER YOU NEED !!! ------------

FUNCTION TEST_VALUE(oBrw,nCol,aArray)
LOCAL nColor := 16777215

IF aArray[oBrw:nArrayAt,nCol] = .T.
        nColor :=  4294133
ENDIF

RETURN nColor
 


Sample 2 ( multiple selections )

Image

Code: Select all  Expand view

function Main()
local oWnd
local oBrw
local nI

local aArray := {}

DEFINE WINDOW oWnd TITLE "Testing Cell-color"

if empty( aArray )
      aArray := {{"one","two",1,"four"},;
            {"one","two",2,"four"},;
            {"one","two",2,"four"},;
            {"one","two",3,"four"}}
endif

@ 0,0 XBROWSE oBrw OF oWnd ;
      COLUMNS {1,2,3,4} ;
      HEADERS {"Col 1","Col 2","Col 3","Col 4"} ;
      array aArray LINES CELL fastedit
      oBrw:nRowHeight := 25

oBrw:aCols[3]:bClrstd := {|| { 0, TEST_VALUE(oBrw, 3, aArray) } }
   
oWnd:oClient := oBrw

oBrw:createfromcode()

activate window oWnd

RETURN NIL

// ------------------

FUNCTION TEST_VALUE(oBrw,nCol,aArray)
LOCAL nColor := 16777215

IF aArray[oBrw:nArrayAt,nCol] = 1
    nColor :=  10681847
ELSEIF aArray[oBrw:nArrayAt,nCol] = 2
    nColor :=  4294133
ELSEIF aArray[oBrw:nArrayAt,nCol] = 3
    nColor :=  10677245
ENDIF

RETURN nColor
 


Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 109 guests