Reputation: 841
I have a TDBGrid and have a Client dataset associated through a TDataSource. When i try to re-arrange the columns of the grid programtically this works fine when there are one or more columns in the grid.
Lets say, i made all the columns visible to false. So, the grid does not have any columns yet. Now, when i set the Index of column at 11 to 0.
Columns[iColIndx].Index := iNewColIndex;
// Assume iColIndx = 11 and iNewColIndex = 0
Columns[iNewColIndex].Visible := True;
//Making the column visible
The above assignment of column index is not getting reflected in the Grid. If i try setting it for twice or thrice, then it is getting reflected. Am i missing anything?
Upvotes: 1
Views: 644
Reputation: 841
I solved it. I have assigned OnDrawDataCell
of the grid for drawing the gradients, but I was not calling the DefaultDrawDataCell
from there. Moreover, the DefaultDrawing
property was turned off.
After setting DefaultDrawing
and calling DefaultDrawDataCell
from within the DrawDataCell
event handler, it is working fine now.
Upvotes: 1