Hey Guys,
Any idea how to do it with TWBrowse?
Tx
Patrick
Hey Guys,
Any idea how to do it with TWBrowse?
Tx
Patrick
NageswaraRao,
Great job!
Thanks it works fine.
Antonio
oBrw:nClrPane := {||iif( OrdKeyNo() % 2 == 0, nEvenColor, nOddColor }Look out with OrdKeyNo.
I had to change it because in network enviroment the application speed its a big problem. See my previous messages.
Antonio
// Purpose : Sample TCBrowse with alternating color rows without a database object
// Author : James Bott
// Date : 1/9/2008
#include "fivewin.ch"
#include "TCBrowse.ch" // <-- Important
function main()
local oWnd, oBrw, lClrFlag, cAlias
use customer
cAlias := alias()
define window oWnd title "TCBrowse Test"
@ 0,0 browse oBrw of oWnd update
oBrw:cAlias := cAlias
add column to browse oBrw data (cAlias)->first
add column to browse oBrw data (cAlias)->last
lClrFlag:=.f.
oBrw:bSkip:={| nRecs | (nRecs:= (cAlias)->(dbskipper( nRecs )), lClrFlag:=if(nRecs/2 = int(nRecs/2), lClrFlag,!lClrFlag), nRecs) }
oBrw:nClrPane := { || if(lClrFlag, rgb(255,255,235), rgb(192,208,179)) }
oBrw:nLineStyle:=0
oWnd:oClient:= oBrw
activate window oWnd
return nil
If the index is large, this function could take some time to complete because index keys are literally counted until the current key is reached.
If usFilterOption contains ADS_RESPECTFILTERS, the Advantage Client Engine must skip through all records referenced by keys in the index that pass the filter and/or scope and count them until the current key is reached. Thus, with large indexes where many records pass the filter and/or keys pass the scope, this function can be very slow.
Mr James
Your solution is a lot more elegant and works well. I agree we can drop considering any other alternative approaches.
I should have tested your approach first. Why did Mr AHF report this approach was not working for him? Working fine for me.
Thank you Mr James
NageswaraRao,
Thanks for confirming that it does work. I don't know why AHF has been unable to get it working. Hopefully he will run the test code and report back.
James
Mr James
Your code works well with tcbrowse and twbrowse.
I am having some issues with txbrowse. ![]()
nageswaragunupudi wrote:Mr James
Your solution is a lot more elegant and works well. I agree we can drop considering any other alternative approaches.
oBrw:nClrPane := { |nRow| iif( nRow % 2 == 0, rgb(255,255,235), rgb(192,208,179)) }James,
Sorry to miss lead you.
Your code works well, however I have several bskip s and it's much easy to alter my own inherited TcBrowse class instead of chekcing out all bskip s.
Once more thanks to all for your help.
Antonio
James Bott wrote:nRecs/2 = int(nRecs/2)
nRecs % 2 = 0AGF,
>Your code works well, however I have several bskip s and it's much easy to alter my own inherited TcBrowse class instead of chekcing out all bskip s.
OK, glad to hear it worked for you. Granted it will be easier right now to use the modified TCBrowse, but then you will have to modify each new version of FWH. If you getting monthly updates of FWH, then that will be more work.
It would be better to create a subclass of TCBrowse. Then you don't need to modify the original TCBrowse source for each new version of FWH.
Modifying the bSkips also would prevent you from having to make any changes with new versions of FWH.
Regards,
James
Personally I prefer solutions without having to change FWH source code. ( Not that I never do it, but it is really a tedious work to keep making changes with every FWH upgrade ), unless Mr. Antonio likes to make a solution part of next release.
There is one issue to rely on bSkip block. It depends on the way the browse object uses the bSkip block. TWbrowse and TCBrowse behave similarly. TXBrowse behaves a bit differently.
We prefer a way which works for all browses and also does not rely on the data source.
I still feel it is better if the browse objects provide evaluation of the bClrPane block or bClrStd block with the visual row number ( or lEvenRow) as parameter. In fact that seemed to be the original intention of the author(s) of TCBrowse.
I agree.
I use already a Tcbrowse subclass.
Antonio