I have a form list. I want alternate coloured lines, and too some degree have acheived this. It is slightly unstable though. On the on after get record I have an XOR boolean statement. Then on the OnFomat of the Control on the list I use the boolean to decided which of either colour it should be. Problem is that on aftergetrecord runs everytime you move the focus. So Imagaine the List goes:- 1 - RED 2 - BLUE 3 - RED 4 - BLUE 5 - RED 6 - BLUE 7 - RED If you were to focus on line no. 5 it would turn Blue. Which is not what I want. I wrote some code so that the XOR statement would only run for the amount of lines there were in the form, and the OnFormat would not run code after this number was meet. But once it reachs the max it turned them all back to black when you clicked on then lines. Any Ideas? (Other than using a line number and working out if its odd or even) Cheers Tony
Looks like you have two issues here, one calculating whether it is an odd or even line, and the second, displaying the color. The color issue is staight forward with onFormat, determining which line you are on is not so easy. Fundamentally you have two options, one add (or use an existing) field on the line to determine if it is odd or even, second (the method you now use) calculate on the fly. Calculating on the fly gives the best results, and I guess is what you want to do. First thing, is get away form the OnAfterGetRecord. Concentrate on calculating the state of the current line, don’t worry about all the rest. So step one is to add a function to the table OK := LineIsEven; then just call that function directly from the OnFormat trigger, that should be the only reference to callling the function. Now look at Form 5824, it has basically what you are after. You will still have one problem, and that is how to address inserted lines, I know that OnGetCurrentRecord can be used to fix this, but try to work a better solution, for me that would be a refresh button at the bottom of the screen. Then you dont get all these problems you currently have, and the system is more stable. And remember KISS [;)] PS you may be surprised to find just how many people are colo(u)r blind, and if you did you would understand why Navision spent so much money back in '94 on getting a team of people to design the basic Grey white black scheme. Good luck. With colo(u)rs I guarantee you will never make everyone happy. Hey we can’t even agree on how to spell the word!!! [;)]
David, Unfortunatly this would not work as I have filtered list view. Thus the Line number’s would not work if they were inserted as part of the recordset. Becuase the list is filtered you could never guarntee a sequential number series. They would have to be added on the fly. Cheers anyway. Tony
I think you really need to look back at the problem, and redesign the solution. It seems pretty clear what you are doing, and why, but it may just no achive the result you are after without a lot of stability issues. Maybe just try expaning the height of the rows.