Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Fun, fun, fun 'til her daddy takes her TBrowse away
I'm writing a basic TBrowse that should have taken me ten minutes, and I'm
stumped by problem with the colorblock property.

I have a ColorSpec table something like this:
// std unsel  std sel   special unsel   special unsel
"W/B+,       W/BG,       R/B+,        R+/BG"

The idea is that when a certain condition is met, the special cell will
show up as bright red on the same color (that's colour for you, Dave)
background as the rest of the cells - blue for unselected, cyan for
selected.  Or to put it another way, normal cells are white on blue
selected, white on cyan unselected; special cells are red on blue
selected, red on cyan unselected.

Easy enough.  Just a minor tweak to the colorblock of the column in
question:

oColumn:colorblock := { |e| iif( SomeCondition, { 3, 4 }, { 1, 2 } }

Copied straight out of the Norton Guide [tm] example, and easy enough that
even I can understand how it works.  The only problem is... it doesn't.

With everything else in the TBrowse standard, it works as advertised.  The
thing is, I want the whole row highlighted, so I use colorrect to
highlight the columns during stabilize.  Again, that by itself works fine.

It's the combination of the two that's blowing up.  My goal is to have the
user arrowing up and down among the rows, with the entire row highlighted,
but colum #1 should be in red with one background color if it's the
selected row, and red on another background color if it's the unselected
row.  If I use the colorblock attribute as shown above, plus the colorrect
statement like this:
 oBrowse:colorrect({oBrowse:rowpos,2,oBro
wse:rowpos,oBrowse:colcount},{2,1})

(note that I am only coloring columns 2-n, since column 1 needs to be
{3,4} rather than {1,2})

... the result is that the colorblock always uses the unselected color
choice (3 if SomeCondition, 1 if not), no matter what.  I thought I would
be smart and add a second colorrect statement:
 oBrowse:colorrect({oBrowse:rowpos,1,oBro
wse:rowpos,oBrowse:1},{2,1})

But of course all that accomplished was to use the conditional colors
{3,4} on column 1, and the normal colors {1,2} on columns 2-n.

Am I trying to reach the unreachable star here?  Is there no way to
combine a colorrect statement for some columns with a conditional
colorblock for other columns?

--
Peter B. Steiger
Cheyenne, WY
If you must reply by email, you can reach me by placing zeroes
where you see stars: wypbs_**3 at bornagain.com.


Report this thread to moderator Post Follow-up to this message
Old Post
Peter B. Steiger
05-25-05 01:55 AM


Re: Fun, fun, fun 'til her daddy takes her TBrowse away
IIRC you can't use an enhanced colour as a background; therefore W/B+
and R/B+ won't work, but W+/B and R+/B would (should).

Peter B. Steiger wrote:
> I'm writing a basic TBrowse that should have taken me ten minutes, and I'm
> stumped by problem with the colorblock property.
>
> I have a ColorSpec table something like this:
> // std unsel  std sel   special unsel   special unsel
>   "W/B+,       W/BG,       R/B+,        R+/BG"
>
> The idea is that when a certain condition is met, the special cell will
> show up as bright red on the same color (that's colour for you, Dave)
> background as the rest of the cells - blue for unselected, cyan for
> selected.  Or to put it another way, normal cells are white on blue
> selected, white on cyan unselected; special cells are red on blue
> selected, red on cyan unselected.
>
> Easy enough.  Just a minor tweak to the colorblock of the column in
> question:
>
> oColumn:colorblock := { |e| iif( SomeCondition, { 3, 4 }, { 1, 2 } }
>
> Copied straight out of the Norton Guide [tm] example, and easy enough that
> even I can understand how it works.  The only problem is... it doesn't.
>
> With everything else in the TBrowse standard, it works as advertised.  The
> thing is, I want the whole row highlighted, so I use colorrect to
> highlight the columns during stabilize.  Again, that by itself works fine.
>
> It's the combination of the two that's blowing up.  My goal is to have the
> user arrowing up and down among the rows, with the entire row highlighted,
> but colum #1 should be in red with one background color if it's the
> selected row, and red on another background color if it's the unselected
> row.  If I use the colorblock attribute as shown above, plus the colorrect
> statement like this:
>  oBrowse:colorrect({oBrowse:rowpos,2,oBro
wse:rowpos,oBrowse:colcount},{2,1}
)
>
> (note that I am only coloring columns 2-n, since column 1 needs to be
> {3,4} rather than {1,2})
>
> ... the result is that the colorblock always uses the unselected color
> choice (3 if SomeCondition, 1 if not), no matter what.  I thought I would
> be smart and add a second colorrect statement:
>  oBrowse:colorrect({oBrowse:rowpos,1,oBro
wse:rowpos,oBrowse:1},{2,1})
>
> But of course all that accomplished was to use the conditional colors
> {3,4} on column 1, and the normal colors {1,2} on columns 2-n.
>
> Am I trying to reach the unreachable star here?  Is there no way to
> combine a colorrect statement for some columns with a conditional
> colorblock for other columns?
>

Report this thread to moderator Post Follow-up to this message
Old Post
Charles Foot
05-25-05 01:55 AM


Re: Fun, fun, fun 'til her daddy takes her TBrowse away
hi,

it depend how you build you Tbrowse.

create "empty" oTBrowse
create each colume with oCol:colorBlock than oTBrowse:addcolumn(oCol)
set oTBrowse:autoLite := .F.

use      oTBrowse:hilite()
before oTBrowse:colorrect
and      oTBrowse:dehilite()

greetings by OHR
Jimmy


"Peter B. Steiger" <see.sig@for.email.address> schrieb im Newsbeitrag
news:pan.2005.05.24.21.27.17.472372@access4less.net...
> I'm writing a basic TBrowse that should have taken me ten minutes, and I'm
> stumped by problem with the colorblock property.
>
> I have a ColorSpec table something like this:
> // std unsel  std sel   special unsel   special unsel
>   "W/B+,       W/BG,       R/B+,        R+/BG"
>
> The idea is that when a certain condition is met, the special cell will
> show up as bright red on the same color (that's colour for you, Dave)
> background as the rest of the cells - blue for unselected, cyan for
> selected.  Or to put it another way, normal cells are white on blue
> selected, white on cyan unselected; special cells are red on blue
> selected, red on cyan unselected.
>
> Easy enough.  Just a minor tweak to the colorblock of the column in
> question:
>
> oColumn:colorblock := { |e| iif( SomeCondition, { 3, 4 }, { 1, 2 } }
>
> Copied straight out of the Norton Guide [tm] example, and easy enough that
> even I can understand how it works.  The only problem is... it doesn't.
>
> With everything else in the TBrowse standard, it works as advertised.  The
> thing is, I want the whole row highlighted, so I use colorrect to
> highlight the columns during stabilize.  Again, that by itself works fine.
>
> It's the combination of the two that's blowing up.  My goal is to have the
> user arrowing up and down among the rows, with the entire row highlighted,
> but colum #1 should be in red with one background color if it's the
> selected row, and red on another background color if it's the unselected
> row.  If I use the colorblock attribute as shown above, plus the colorrect
> statement like this:
>
 oBrowse:colorrect({oBrowse:rowpos,2,oBro
 wse:rowpos,oBrowse:colcount},{2,1})[colo
r=darkred]
>
> (note that I am only coloring columns 2-n, since column 1 needs to be
> {3,4} rather than {1,2})
>
> ... the result is that the colorblock always uses the unselected color
> choice (3 if SomeCondition, 1 if not), no matter what.  I thought I would
> be smart and add a second colorrect statement:
>  oBrowse:colorrect({oBrowse:rowpos,1,oBro
wse:rowpos,oBrowse:1},{2,1})
>
> But of course all that accomplished was to use the conditional colors
> {3,4} on column 1, and the normal colors {1,2} on columns 2-n.
>
> Am I trying to reach the unreachable star here?  Is there no way to
> combine a colorrect statement for some columns with a conditional
> colorblock for other columns?
>
> --
> Peter B. Steiger
> Cheyenne, WY
> If you must reply by email, you can reach me by placing zeroes
> where you see stars: wypbs_**3 at bornagain.com.
>[/color]



Report this thread to moderator Post Follow-up to this message
Old Post
AUGE_OHR
05-25-05 01:55 AM


Re: Fun, fun, fun 'til her daddy takes her TBrowse away
On Tue, 24 May 2005 23:55:11 +0200, AUGE_OHR sez:
> it depend how you build you Tbrowse.
>
> create "empty" oTBrowse
> create each colume with oCol:colorBlock than oTBrowse:addcolumn(oCol) set
> oTBrowse:autoLite := .F.
>
> use      oTBrowse:hilite()
> before oTBrowse:colorrect
> and      oTBrowse:dehilite()

Interesting!  Unfortunately it has the same effect whether I manually
highlight (using the hilite/dehilite methods) or use autolite.

No matter.  I can live with the special cells being the same color when
you are or are not selecting that row... as long as the user's eye is
drawn to the red ones, I'm happy.

--
Peter B. Steiger
Cheyenne, WY
If you must reply by email, you can reach me by placing zeroes
where you see stars: wypbs_**3 at bornagain.com.


Report this thread to moderator Post Follow-up to this message
Old Post
Peter B. Steiger
05-25-05 01:55 AM


Re: Fun, fun, fun 'til her daddy takes her TBrowse away
On Wed, 25 May 2005 09:46:50 +1200, Charles Foot sez:
> IIRC you can't use an enhanced colour as a background; therefore W/B+ and
> R/B+ won't work, but W+/B and R+/B would (should).

Sadly, that's not the problem.  See the setblink() function: with
setblink(.f.), you can use the "*" attribute on color pairs to make the
background appear with enhanced colors, rather than blinking.

--
Peter B. Steiger
Cheyenne, WY
If you must reply by email, you can reach me by placing zeroes
where you see stars: wypbs_**3 at bornagain.com.


Report this thread to moderator Post Follow-up to this message
Old Post
Peter B. Steiger
05-25-05 01:55 AM


Re: Fun, fun, fun 'til her daddy takes her TBrowse away
hi,
 
>
> Interesting!  Unfortunately it has the same effect whether I manually
> highlight (using the hilite/dehilite methods) or use autolite.
>
> No matter.  I can live with the special cells being the same color when
> you are or are not selecting that row... as long as the user's eye is
> drawn to the red ones, I'm happy.

now i got it.

if you use "build in" oTBrowse:colorrect it will change all cell color
in a rectangular area with your oTBrowse:colorSpec(), but you like
to have oCol:colorBlock in that oTBrowse:hilite bar.

you have to make you own function/class "to paint" something like

oCol:Color - oTB:Color - oCol:Color - oTB:Color - oTB:Color

you have to step throw oCol and "paint" oCol:Color or oTB:Color

canīt find my "old cl*pper" code, this is Xbase++

greetings by OHR
Jimmy

CLASS XbpColumnLocal FROM XbpColumn
 ****************************************
**
EXPORTED:
INLINE METHOD HiliteRow( nRowPos, lHilite, lFrame, lRepaint )
 ****************************************
*********************
LOCAL aColor
LOCAL RETVAR

IF ( lHilite )                     // .AND. ( aColor:= Eval(
::colorBlock ) ) # nil
IF ::colorBlock # NIL
// is there any :colorbock
aColor:= Eval( ::colorBlock )
IF aColor = NIL
// is any color
RETVAR := ::XbpColumn:HiliteRow( nRowPos, lHilite, lFrame,
lRepaint ) // recursive next
ELSE
RETVAR := ::dataArea:setCellColor( nRowPos, aColor[ 1 ],
aColor[ 2 ] ) // paint CellColor
ENDIF
ELSE
RETVAR := ::XbpColumn:HiliteRow( nRowPos, lHilite, lFrame,
lRepaint ) // recusive next
ENDIF
ELSE
RETVAR := ::XbpColumn:HiliteRow( nRowPos, lHilite, lFrame, lRepaint )
// recursiv next
ENDIF
RETURN RETVAR
ENDCLASS

*
* eof
*




Report this thread to moderator Post Follow-up to this message
Old Post
AUGE_OHR
05-25-05 01:55 AM


Re: Fun, fun, fun 'til her daddy takes her TBrowse away
found my old cl+pper code
 

must be first :   oTBrowse:colorrect( ....) and than

*- freeze the cursur on position P2
oTbrowse:COLPOS     := fix_posi +2
*- highlight current cell
oTbrowse:HILITE()

*- freeze the cursur on position P1
oTbrowse:COLPOS     := fix_posi
*- highlight current cell
oTbrowse:HILITE()

and so on

greetings by OHR
Jimmy



Report this thread to moderator Post Follow-up to this message
Old Post
AUGE_OHR
05-25-05 01:55 AM


Re: Fun, fun, fun 'til her daddy takes her TBrowse away
Peter

I think your trying to create a multi-coloured hilite bar, if so then you wo
n't
achieve it with the normal TBrowse class.

There's code available on  the OASIS that can do this for you though
(tbhilite.zip)

HTH
Steve



Report this thread to moderator Post Follow-up to this message
Old Post
Stephen Quinn
05-25-05 08:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Clipper archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:28 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.