FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Tcbrowse 2 colour one for each line
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Tcbrowse 2 colour one for each line
Posted: Wed Jan 09, 2008 05:54 PM

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

Regards

Antonio H Ferreira
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Tcbrowse 2 colour one for each line
Posted: Wed Jan 09, 2008 06:02 PM

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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Tcbrowse 2 colour one for each line
Posted: Wed Jan 09, 2008 06:28 PM

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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Skipper
Posted: Wed Jan 09, 2008 07:48 PM

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
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Tcbrowse 2 colour one for each line
Posted: Wed Jan 09, 2008 07:52 PM

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
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Tcbrowse 2 colour one for each line
Posted: Wed Jan 09, 2008 08:14 PM

Antonio,

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

Antonio

Regards

Antonio H Ferreira
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Tcbrowse 2 colour one for each line
Posted: Wed Jan 09, 2008 08:46 PM

You are right...

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Tcbrowse 2 colour one for each line
Posted: Wed Jan 09, 2008 08:50 PM

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

Regards

Antonio H Ferreira
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Tcbrowse 2 colour one for each line
Posted: Thu Jan 10, 2008 12:35 AM

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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Tcbrowse 2 colour one for each line
Posted: Thu Jan 10, 2008 12:37 AM

AHF,

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

What RDD are you using?

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
ADSKeyNo()
Posted: Thu Jan 10, 2008 01:07 AM

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
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Tcbrowse 2 colour one for each line
Posted: Thu Jan 10, 2008 08:32 AM

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

Regards

Antonio H Ferreira
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Tcbrowse 2 colour one for each line
Posted: Thu Jan 10, 2008 12:10 PM

None of the above solutions is working.

Any ideas?

Antonio

Regards

Antonio H Ferreira
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Tcbrowse 2 colour one for each line
Posted: Thu Jan 10, 2008 01:20 PM
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
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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Tcbrowse 2 colour one for each line
Posted: Thu Jan 10, 2008 02:06 PM
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.
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:
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