Hi,
Is there an event when a row comes into view (is displayed on the screen)?. I am looking for an event similar with RowLoaded event of Sheridan AciveX grid. When a grid has many rows, setting the cells appearances into the InitializeRow event takes a lot of time. It will be better to setup the cell appearances when needed only (row needs to be displayed). I tried to use ConditionValueAppearance but it seems that you can change teh appearance of a cell based on it's value not on the values of other cells. In my program I need to set appearances of some cells or the whole row based on values of other cells in the grid (that in fact may be hidden)
Emil
Hi Emil,
No, there is no such event. InitializeRow is really the best place to apply colors to rows or cells.
emil10 said:setting the cells appearances into the InitializeRow event takes a lot of time
Why would this take a lot of time? My guess is that your code may not be as efficient as possible. Can you post a sample of what you are doing here?
Mike,
The code is very simple. For example:
if e.Row.cells(1).value = 'XXX' then
e.row.cells(0).appearance = myappearance
end if
The problem is the number of rows in the grid. If you have more than 20000 rows and you have to setup 10-12 columns appearances for each row you have a problem because InitializeRow is fired for each row.I used the Shridan DataWidgets grid on unbound mode on VB6 in the past and the RowLoaded event worked very well because it fired only when a row needed to be displayed. Something like that will be very handy for the Ultragrid because you don't really need to setup coilumn colors before bringing the row into view. I tried to use the ValueBasedAppearance of columns with ConditionValueAppearance objects but that one seems to handle only changing column appearance based on its value, not on other column(s) value(s). Is it possible to use ValueBaseAppearance based on values of other column(s)? Can you show a sample code if this is possible
ValueBasedAppearance only works for that value of the specific cell you are working with, you can't base it on a Value in another cell as far as I know.
I think you can prevent the grid from loading rows until they are needed by setting layout.LoadStyle to LoadOnDemand. But this won't help once you try to sort or filter the grid, because either of these will force the loading of all rows.
It seems like your best option would be to use a DrawFilter.
I did a little more checking and it turns out I am wrong, you can use a ValueBasedAppearance to base the appearance on another cell in the row using a FormulaCondition (along with an UltraCalcManager component).
Thank you Mike. Do you have a few lines of code with this? I cannot figgure out how to do it from the example in Samples Explorer.