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
different column color
- MarcoBoschi
- Posts: 1071
- Joined: Thu Nov 17, 2005 11:08 am
- Location: Padova - Italy
- Contact:
Re: different column color
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) } }

Define Column / cell-color from Function
Best Regards
Uwe
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) } }

Define Column / cell-color from Function
Code: Select all | Expand
...
...
// 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

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.
i work with FW.
If you have any questions about special functions, maybe i can help.
- MarcoBoschi
- Posts: 1071
- Joined: Thu Nov 17, 2005 11:08 am
- Location: Padova - Italy
- Contact:
Re: different column color
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)
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)
Marco Boschi
info@marcoboschi.it
info@marcoboschi.it
Re: different column color
Marco,
this is the xBrowse-solution !!!!
I didn't notice, You used => TcColumn
Best Regards
Uwe
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.
i work with FW.
If you have any questions about special functions, maybe i can help.
- MarcoBoschi
- Posts: 1071
- Joined: Thu Nov 17, 2005 11:08 am
- Location: Padova - Italy
- Contact:
Re: different column color
Marco,
there is a very good TCBROWSE-sample TESTTCBBR.prg
select option : oDbfBrowse

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
there is a very good TCBROWSE-sample TESTTCBBR.prg
select option : oDbfBrowse

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

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.
i work with FW.
If you have any questions about special functions, maybe i can help.
- MarcoBoschi
- Posts: 1071
- Joined: Thu Nov 17, 2005 11:08 am
- Location: Padova - Italy
- Contact:
Re: different column color
Uwe,
I'm rewriting (it's a little program)
with xbrowse
Many thanks
I'm rewriting (it's a little program)
with xbrowse
Many thanks
Marco Boschi
info@marcoboschi.it
info@marcoboschi.it
- Rick Lipkin
- Posts: 2668
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Re: different column color
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.

Hope this gives you a few ideas ..
Rick Lipkin
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
oLbx:lRecordSelector := .f.

Hope this gives you a few ideas ..
Rick Lipkin