Tcbrowse 2 colour one for each line

Postby AHF » Wed Jan 09, 2008 5: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby James Bott » Wed Jan 09, 2008 6: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby James Bott » Wed Jan 09, 2008 6: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Skipper

Postby TimStone » Wed Jan 09, 2008 7: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
User avatar
TimStone
 
Posts: 2904
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Postby Antonio Linares » Wed Jan 09, 2008 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby AHF » Wed Jan 09, 2008 8:14 pm

Antonio,

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

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

Postby Antonio Linares » Wed Jan 09, 2008 8:46 pm

You are right...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby AHF » Wed Jan 09, 2008 8: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby James Bott » 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby James Bott » 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

ADSKeyNo()

Postby TimStone » Thu Jan 10, 2008 1: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
User avatar
TimStone
 
Posts: 2904
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Postby AHF » Thu Jan 10, 2008 8: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby AHF » Thu Jan 10, 2008 12:10 pm

None of the above solutions is working.

Any ideas?

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

Postby nageswaragunupudi » Thu Jan 10, 2008 1: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
Code: Select all  Expand view
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: 10247
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby nageswaragunupudi » Thu Jan 10, 2008 2: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.
Code: Select all  Expand view
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  Expand view
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
User avatar
nageswaragunupudi
 
Posts: 10247
Joined: Sun Nov 19, 2006 5:22 am
Location: India

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 67 guests