Tcbrowse 2 colour one for each line

AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

Antonio,

When the highlite reachs the last line of the browse if you go over it always returns the numer of the last row.
If we have 25 rows it always return 25.

I don't see how it can works.

Antonio
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

AHF,

Here is a skipblock that doesn't use a database object:

oBrw:bSkip:={| nRecs | (nRecs:= (cAlias)->(_dbskipper( nRecs )), lClrFlag:=if(nRecs/2 = int(nRecs/2), lClrFlag,!lClrFlag), nRecs) }

James
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Here is a suggestion. I didn't put this in my example, but I would remove the lines.

oBrw:nLineStyle:=0

You don't need lines when you have colored rows, and it looks better without the lines.

James
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Skipper

Post by TimStone »

James,

A reminder ... with ADS, using tSBrowse ( and I would assume others ), nRecs is returned as an unknown type of data element when there are no records to browse. Thus, using the ordKeyNo() ( or ADSKeyNo() ) method described by Antonio will work without a problem.

Of course, I am using data objects ... love them ... wouldn't be without them.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Antonio,

This one does not need to manage the DBF or the browse row. Just requires a logical variable:

oLbx:nClrPane := { || lClr := ! lClr, If( lClr, rgb(...), rgb(...) ) }

I haven't tested it, but it seems it could work
regards, saludos

Antonio Linares
www.fivetechsoft.com
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

Antonio,

Its a Tcbrowse. nClrPane is evaluate on each column painting.
It doesn't work.

Antonio
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

You are right...
regards, saludos

Antonio Linares
www.fivetechsoft.com
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

I've tried this code it works except when there are rows above first visible row.

mbrowse:nClrPane := { | nRowPos, nJ| if(nj=mbrowse:ncolpos,lClr := ! lClr,lClr),;
If( lClr, mbrowse:ncor1, mbrowse:ncor2 ) }

Any ideas ?

Antonio
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Tim,

>A reminder ... with ADS, using tSBrowse ( and I would assume others ), nRecs is returned as an unknown type of data element when there are no records to browse.

I'm sure we could write a routine to trap unknown data types.

>Thus, using the ordKeyNo() ( or ADSKeyNo() ) method described by Antonio will work without a problem.

AHF says that using ordKeyNo() makes it very slow, thus I was showing another way without using ordKeyNo(). He did not state which RDD he was using.

James
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

AHF,

Did you try my skipblock for non-object databases as shown above?

What RDD are you using?

James
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

ADSKeyNo()

Post by TimStone »

With this function I have no speed issue. In fact, your modifications of tSBrowse make it FLY with the mousewheel ...
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

I'm using RMDBCDX wich works ok except in what concernes networking with the use of ordkeyno or ordkeycount.

It seems that this RDD has no caching as Clipper did thus the applications using these functions extensively within a network will see a speed degradation to a point were you can't work anymore.

I'm in the process of using ADS but I have some problems with the convertion process, so for now I must use other alternative RDD.

I'm trying James skipblock but it seems it will not work. My former nClrPane block it works only skipping down the table I 'm figuring out why. Since it is a Tcbrowse object and the nClrPane is evaluated painting each column the block can only be evaluate once for each line otherwise you'll get a chess browse.

Antonio
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

None of the above solutions is working.

Any ideas?

Antonio
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

TCBrowse natively tries to provides a way to paint different colors on the basis of visual row numbers. If obrw:nClrPane is a code block, the paint method evaluates obrw:nclrpane, with visual row number and column number as two parameters. If the the following code is adopted

Code: Select all

oBrw:nClrPane := { |nRow| iif( nRow % 2 == 0, rgb(255,255,235), rgb(192,208,179)) }
the browse paints alternative rows with different colors. It works well if the naviagation is by PgDn, PgUp, Vertical ScrollBar, but fails when the page is scrolled with down or up keys or mouse wheel.

May be some modifications to the paint method can make it work in all cases. If this can be made to work, we can achieve the effect, without depending on the underlying data source ( array or dbf or whatever be the RDD)

I personally feel that with some effort browse classes can give the facility to paint different colors because the browse object only knows the visiual row number it is painting.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

I made a few modifications in the TCBrowse Class. With these modifiations the above code works fine in all cases:

Modififcations are : ( I am giving line numbers in the latest source code of TCBrowse.Prg provided with FWH 8,01 ). With a view to not to change the line numbers I inserted new code in the present blank lines.

Code: Select all

Line 44: Instead of blank line :
            DATA nRowScrol  AS NUMERIC INIT 0
//
In method paint()
Line 253: In the present blank line:
            ::nRowScrol := 0
//
In method drawline, at line number 415
Instead of old code:
nClrBack := Eval( nClrBack, If( xRow == nil, nRowPos, xRow ) , nJ ) 
Substitute the new code:
nClrBack := Eval( nClrBack, If( xRow == nil, nRowPos, xRow ) + ::nRowScrol , nJ )
//
Method GoDown(): Substitute Old Line 1086
Instead of :
  ::lRepaint := .f.
Substitute :
  ::lRePaint := .f. ; ::nRowScrol := iif( ::nRowScrol == 0, 1, 0 )
//
Method GoUp() : Substitute old line 1128
Instead of :
  ::lRepaint := .f.
Substitute :
  ::lRePaint := .f. ; ::nRowScrol := iif( ::nRowScrol == 0, 1, 0 )
After making the above changes in the tcbrowe class, the following code in the application program works fine:

Code: Select all

oBrw:nClrPane := { |nRow| iif( nRow % 2 == 0, rgb(255,255,235), rgb(192,208,179)) } 
Now we are not bothered whatever is the data source, rdd or array
Regards

G. N. Rao.
Hyderabad, India
Post Reply