Make sure your grid is not reconstructed in run-time. VFP makes columns reconstructuon in run-time in several cases that cause lose of all properties and code difines inside of the columns, headers and controls.
I solved this problem by making my own header class. When user makes any change of the column, header's Click event fires. Thus I trap it, and track column size and column order change (I store old width and order in the my header class properties). THan fire appropriate method of grid where developers that use my grid class can define code for any column resize or move. No need to put code in the column.
Than, you can add new header class programmatically to the grid columns - and here you are.
I had resorted to the 'brute force' approach of scanning the grid columns, re-populating the column widths array before a change was likely and then re-contructing after the change.
It works but is not as elegant as your solution. I definitely look into creating a header class.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.