FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour XBrowse alternating row colors
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
XBrowse alternating row colors
Posted: Tue Jan 22, 2008 10:11 PM

I just tried James sample using FWH 8.01 and it seems to work fine here.

EMG

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
XBrowse alternating row colors
Posted: Wed Jan 23, 2008 12:28 AM

Enrico,

>I just tried James sample using FWH 8.01 and it seems to work fine here.

Thank you for reporting that.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 670
Joined: Wed Oct 19, 2005 06:41 PM
XBrowse alternating row colors
Posted: Wed Jan 23, 2008 12:58 AM

James Nice Sample
we compile with fwh 2.7 and xHarbour and works well

with only .dbf
with .dbf + Index
with .dbf + Index + Filter

Thanks

att

Wilson 'W' Gamboa A
Wilson.josenet@gmail.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
XBrowse alternating row colors
Posted: Wed Jan 23, 2008 01:52 AM

Wilson,

>we compile with fwh 2.7 and xHarbour and works well.

Thanks for reporting. This means it should work even with older versions of XBrowse.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
XBrowse alternating row colors
Posted: Wed Jan 23, 2008 02:24 AM

Hi James,

I fix I test. I add ::oBrw:Refresh() and work fine.
So your sample work fine.

Regards,

Richard

Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
XBrowse alternating row colors
Posted: Wed Jan 23, 2008 02:57 AM

Richard,

>I fix I test. I add ::oBrw:Refresh() and work fine.

Good news. Thanks.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
XBrowse alternating row colors
Posted: Wed Jan 23, 2008 03:38 AM
James Bott wrote:Richard and NageswaraRao,

I am at a loss as to why it isn't working for you. I'm thinking it must be differences in TXBrowse. NageswaraRao, didn't you say in another message thread that you are using a modified TXBrowse? Could you be linking in this instead of the standard FWH version?

I am using xHarbour, are you?

James

I use modified txbrowse for my software.

But when i test anything here for the forum discussions, I test with FWH 8.01 libraries only and do not use my extensions. Some time today i shall work again when i get some time and come out with the circumstances under which it breaks.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
XBrowse alternating row colors
Posted: Thu Jan 24, 2008 04:26 AM
Mr James


James Bott wrote:Richard and NageswaraRao,

I am at a loss as to why it isn't working for you. I'm thinking it must be differences in TXBrowse. NageswaraRao, didn't you say in another message thread that you are using a modified TXBrowse? Could you be linking in this instead of the standard FWH version?

I am using xHarbour, are you?

James


I have tested using exact copy of your code with unmodified libraries of FWH 8.01. The problem I reported arises occasionally under different circumstances. One I report here.

1) Please start your application.
(a) Resize the window to increase the height to bring into visibility one more row. Now thre are odd number of rows. Make sure that the number of rows displayed is an odd number.
(b) Click on 2nd row. Then click on 4th tow. Then keep clicking on even rows till the last even row.
This is the result of the screen shot.



There are quite a few other circustances when the logic fails. But I hope one example is enough.

I still feel there is no substitute for the Browse calling the color codeblock with the visible row number as a parameter as we earlier discussed about tcbrowse class.
Regards



G. N. Rao.

Hyderabad, India
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
XBrowse alternating row colors
Posted: Thu Jan 24, 2008 07:49 AM

NageswaraRao,

I see the problem you described. I will have to think about a solution.

>I still feel there is no substitute for the Browse calling the color codeblock with the visible row number as a parameter as we earlier discussed about tcbrowse class.

This does not seem so easy. In addition to the visible row number you would also need to know which color the first row was in order to figure out which color to make the current row. So you would need var to keep track of this and you would have to update it each time the first visible row was a new record. Then you would have to calculate the color of the current row based on the color of the first row and the row number of the current row.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
XBrowse alternating row colors
Posted: Thu Jan 24, 2008 07:52 AM
James Bott wrote:NageswaraRao,

This does not seem so easy. In addition to the visible row number you would also need to know which color the first row was in order to figure out which color to make the current row. So you would need var to keep track of this and you would have to update it each time the first visible row was a new record. Then you would have to calculate the color of the current row based on the color of the first row and the row number of the current row.

James

Yes. All that is taken care of in my tcbrowse solution. You just check if it is even or odd. Please make the modifications i suggested to tcbrowse class it will work without problem.
Regards



G. N. Rao.

Hyderabad, India
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
XBrowse alternating row colors
Posted: Thu Jan 24, 2008 08:07 AM

Hello NageswaraRao,
was this the solution you suggested?

Best regards,
Otto

oBrw:bClrStd := { || Colores() }

//-----------------------
STATIC FUNCTION Colores()
LOCAL aCol:={}
IF (ordkeyno()) % 2 == 0
aCol:={CLR_BLACK, RGB(193,221,255) }
ELSE
aCol:={CLR_BLACK, RGB(221,245,255) }
ENDIF
RETURN (aCol)

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
XBrowse alternating row colors
Posted: Thu Jan 24, 2008 08:09 AM

no

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
XBrowse alternating row colors
Posted: Thu Jan 24, 2008 08:16 AM
Regards



G. N. Rao.

Hyderabad, India
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
XBrowse alternating row colors
Posted: Thu Jan 24, 2008 09:05 AM

Thank you.
I don't use TCBROWSE.
But the code I posted works for me.
Regards
Otto

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
XBrowse alternating row colors
Posted: Thu Jan 24, 2008 09:21 AM

You can use this line with TXBrowse and it elminates the problem described by NageswaraRao.

oBrw:bClrStd:= {|| if( (cAlias)->(ordkeyno()) % 2 == 0 ,{ CLR_BLACK, COLOR_LIGHT },{ CLR_BLACK, COLOR_DARK }) }

However, I understand that ordkeyno() is very slow with ADS so you probably can't use it with ADS.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10