Thanks Nadya,
Yur message got me started, but I found that this works for every resize() I could think of.
with Column
lnWidthTotal ;
= 3 ;
+ IIF(.DELETEMARK,8,0) ;
+ IIF(.RECORDMARK,10,0) ;
+ IIF(.SCROLLBARS>1,sysmetric(5),0) ;
+ .COLUMNCOUNT
for each loColumn in .Columns
lnWidthTotal = lnWidthTotal + loColumn.Width
endfor
endwith
Do you have any idea why my formula works better for me? Maybe different screen resolutions?
>Check out
Re: How To Programmatically set column widths in dynamic gri Thread #
689312 Message #
689340>
>>I'm using VFP 7.0
>>
>>When I resize my Grid, the Grid.Width doesn't resize properly.
>>
>>My grid base class sets the Grid.Width programically by adding all the Column.Widths plus extra for the scroll bars, delete mark, column lines, etc.
>>But when it resizes larger, the Grid.Width is ALWAYS too wide and leaves extra space on the right of the last column.
>>And when it resizes smaller, the Grid.Width is ALWAYS too narrow trigger a scroll bar along the bottom.
>>
>>How can I calculate the correct width for a grid (just wide enough to avoid a scroll bar at the bottom) so that it appears the same when it resizes?
>>
>>As I was writing this, it just occured to me that the static components of a grid (scrollbar, deletemark, columnlines, etc) probably don't resize. So maybe I have to subtract the static widths before calculating the resize amount and then add them back in after the calculation?
>>
>>Hos do I determine the width of all the static grid components?
>>
>>TIA
Bill Morris