Mike Lewis
Programmer
I just came across this interesting problem, and I thought I'd share the solution in case anyone else comes up against it.
A client reported that his grids were acting strangely. If the user makes a column wider, and if, as a result, a horizontal scollbar appears, strange things happen.
In particular, right-scrolling the grid causes the columns to "break up"; sometimes you see a spurious blank column, and sometimes a column is repeated. If you click somewhere in the grid to move to a different record, some cells seem to move to a different column.
After a little trial and error, we found the cause. The problem only occurs when the grid contains an invisible column, that is, one whose Visible property is .F.
We fixed it by changing Visible to .T., setting the column's Width to 0, and making the column non-resizable. Once that was done, the strange behaviour went away.
That said, I'm not sure why the grids needed to contain an invisible column. If you don't want to show a certain field, it can simply be excluded from the grid. We ended up doing that.
So, just in case anyone comes up against the same issue, that's how to fix it.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro tips, advice, training, consultancy
Custom software for your business
A client reported that his grids were acting strangely. If the user makes a column wider, and if, as a result, a horizontal scollbar appears, strange things happen.
In particular, right-scrolling the grid causes the columns to "break up"; sometimes you see a spurious blank column, and sometimes a column is repeated. If you click somewhere in the grid to move to a different record, some cells seem to move to a different column.
After a little trial and error, we found the cause. The problem only occurs when the grid contains an invisible column, that is, one whose Visible property is .F.
We fixed it by changing Visible to .T., setting the column's Width to 0, and making the column non-resizable. Once that was done, the strange behaviour went away.
That said, I'm not sure why the grids needed to contain an invisible column. If you don't want to show a certain field, it can simply be excluded from the grid. We ended up doing that.
So, just in case anyone comes up against the same issue, that's how to fix it.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro tips, advice, training, consultancy
Custom software for your business