different column color

different column color

Postby MarcoBoschi » Fri Apr 12, 2013 1:15 pm

Hi,
I'm trying to obtain a coloured column without success!

REDEFINE BROWSE oBrw ID 101 OF oDlg FONT oFont

cHeading := "CODE KIT"
bLine := "{|| field->code }"
oCol := TcColumn():New( cHeading , &bLine , , CLR_GREEN , CLR_WHITE , 0 , 100 , , , , , , , )
oBrw:addcolumn( oCol )

Thanks in advance
Marco
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: different column color

Postby ukoenig » Fri Apr 12, 2013 1:45 pm

Marco,

You can define the col-Background-color, or use a function, to define different cell-colors of a column.

oBrw:aCols[4]:bClrstd := {|| { 0, 255 } } // TEST_SIZE(oBrw, 4) } }
oBrw:aCols[5]:bClrstd := {|| { 16777215, 11556864 } } // TEST_SIZE(oBrw, 5) } }


Image

Define Column / cell-color from Function

Code: Select all  Expand view  RUN

...
...
// The selected Columns 4 and 5, to define the color
// instead of TEST_SIZE(oBrw,.... ) You can use a color-value
oBrw:aCols[4]:bClrstd := {|| { 0, TEST_SIZE(oBrw, 4) } }
oBrw:aCols[5]:bClrstd := {|| { 0, TEST_SIZE(oBrw, 5) } }
...
...
FUNCTION TEST_SIZE(oBrw,nCol)
LOCAL nColor := 16777215
IF ncol = 4
    IF (1)->IMGWIDTH > aRect[4] - 250
        nColor :=  13092607
    ELSEIF (1)->IMGWIDTH > aRect[4] - 200
        nColor :=  11906815
    ELSEIF (1)->IMGWIDTH > aRect[4] - 150
        nColor :=  9997567
        ELSEIF (1)->IMGWIDTH  > aRect[4] - 100
        nColor :=  6446847
        ELSEIF (1)->IMGWIDTH > aRect[4] - 50
        nColor :=  5329407
    ENDIF
ENDIF
IF ncol = 5
    IF (1)->IMGHEIGHT > aRect[3] - 250
        nColor :=  13092607
    ELSEIF (1)->IMGHEIGHT > aRect[3] - 200
        nColor :=  11906815
    ELSEIF (1)->IMGHEIGHT > aRect[3] - 150
        nColor :=  9997567
        ELSEIF (1)->IMGHEIGHT  > aRect[3] - 100
        nColor :=  6446847
        ELSEIF (1)->IMGHEIGHT > aRect[3] - 50
        nColor :=  5329407
    ENDIF
ENDIF

RETURN nColor
 


Best Regards
Uwe :lol:
Last edited by ukoenig on Fri Apr 12, 2013 2:41 pm, edited 1 time in total.
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

Re: different column color

Postby MarcoBoschi » Fri Apr 12, 2013 2:21 pm

Many thanks Uwe,
It's very strange!

oBrw:aCols[1]:bClrstd := {|| { 0, 255 } }
oBrw:aCols[2]:bClrstd := {|| { 0, 255 } }
When I run it
I have this error
Application
===========
Path and name: c:\bin\kit\kit_pto.exe (32 bits)
Size: 2,708,992 bytes
Time from start: 0 hours 0 mins 1 secs
Error occurred at: 12/04/2013, 16:20:43
Error description: Warning BASE/1004 Message not found: TCBROWSE:ACOLS
Args:

Stack Calls
===========
Called from: source\rtl\tobject.prg => TCBROWSE:ERROR(172)
Called from: source\rtl\tobject.prg => TCBROWSE:MSGNOTFOUND(205)
Called from: source\rtl\tobject.prg => TCBROWSE:ACOLS(0)
Called from: cal.prg => DISTINTE(490)
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: different column color

Postby ukoenig » Fri Apr 12, 2013 2:25 pm

Marco,

this is the xBrowse-solution !!!!

I didn't notice, You used => TcColumn

Best Regards
Uwe :?:
Last edited by ukoenig on Fri Apr 12, 2013 2:27 pm, edited 1 time in total.
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

Re: different column color

Postby MarcoBoschi » Fri Apr 12, 2013 2:27 pm

I use tcbrowse
:(
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: different column color

Postby ukoenig » Fri Apr 12, 2013 2:38 pm

Marco,

there is a very good TCBROWSE-sample TESTTCBBR.prg
select option : oDbfBrowse

Image

ADD COLUMN TO BROWSE oBrw ;
DATA FieldWBlock("BAKIYE", Select("Stok")) ; // we can edit it
HEADER "Bakiye" OEM ALIGN RIGHT ;
PICTURE "###,###.##" EDITABLE WIDTH 70 PIXELS ;
COLOR If( Stok->BAKIYE < 0, CLR_RED, CLR_BLACK), {||CLR_GREEN } ;
MESSAGE "Enter a negative number" ;
VALID {|o| o:varGet() >= 0} ;
ERROR MESSAGE "Value must be"+CRLF+"positive or 0"

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

Re: different column color

Postby MarcoBoschi » Fri Apr 12, 2013 3:00 pm

Uwe,
I'm rewriting (it's a little program)
with xbrowse
Many thanks
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: different column color

Postby Rick Lipkin » Fri Apr 12, 2013 4:06 pm

Marco

I use xBrowse because it is actively being supported and has a tremendous flexibility. I will say this .. I recently re-wrote an old Listbox application and wanted to keep the same ( kinda ) look and feel and I found that you can turn off the left side row selection with this quick line inserted to your xBrowse code.

Code: Select all  Expand view  RUN

oLbx:lRecordSelector := .f.
 


Image

Hope this gives you a few ideas ..

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 62 guests