Page 1 of 1

DCBROWSE COLOR determine record with highlight bar

Posted: Tue Aug 31, 2010 8:10 am
by Cliff Wiernik
I have a DCBROWSE ... COLOR command that works fine. However, I would like to have a different color array combination for the record that is displayed as the current selected record.

color1, etc. is a FG/BG color array as defined in the dcbrowse help

For example
iif (condition .and. not selected record,color1, color2) otherwise iif(condition and selected record,color3,color4))

I need to know if it is possible to know for purpose of the color display, when it is on the selected line because my color1/color2 does not show up as well against the blue line selected bar.

This is a database browse.

Cliff.

Re: DCBROWSE COLOR determine record with highlight bar

Posted: Tue Aug 31, 2010 8:59 am
by rdonnay
Cliff -

I think you can do this, but you may have to use CURSORMODE XBPBRW_CURSOR_NONE.

Try this (I haven't tested it):

Code: Select all

nRecordMarked := RecNo()

@ .. DCBROWSE .. COLOR {||IIF(nRecordMarked==RecNo(),{nil,GRA_CLR_YELLOW},{nil,nil}} ;
      ITEMMARKED {||nRecordMarked := RecNo()} ;
      CURSORMODE XBPBRW_CURSOR_NONE
Roger

Re: DCBROWSE COLOR determine record with highlight bar

Posted: Tue Aug 31, 2010 12:43 pm
by Cliff Wiernik
Thanks, Roger.

I used the following modification of your suggestions and it works fine. I am using CURSORMODE XBPBRW_CURSOR_ROW.

Code: Select all

        
COLOR {|| iif(!nRecordMarked==(cAlias)->(recno()) .AND. (cAlias)->lbadacct,{GRA_CLR_YELLOW,GRA_CLR_RED},{nil,nil})}   

Re: DCBROWSE COLOR determine record with highlight bar

Posted: Thu Sep 02, 2010 12:18 pm
by Cliff Wiernik
I ran into problems with item selected clause screwing things up. I settled on the the following code which worked all the time. The key was the use of the {nil,nil}.

Code: Select all

COLOR {|| iif(condition{GRA_CLR_YELLOW,GRA_CLR_RED},{nil,nil})}  
Thanks,

Cliff.