Call grid.GridHitTest() from the grid.Click()?
Update!
Hmm, that didn't work, but a BINDEVENT to a column object resize did work.
In the form.Init, I did:
this.AddProperty("fitter")
this.fitter = NEWOBJECT("fitter","fitter.prg")
BINDEVENT(this.grid1.column1,"resize",thisform.fitter,"gridfitter",1)
And in the fitter.prg I had:
DEFINE CLASS fitter AS custom
FUNCTION gridfitter
WAIT WINDOW "autofit fired"
ENDFUNC
ENDDEFINE
Note this also fires when you resize column1, so maybe you could also employ GridHitTest to determine if the AutoSize was indeed where the hit took place.
>Yes I could do it like this
>
>I'm really looking for an event on that small button on the upper left corner. They manage to put one on the deletemark so why not on the autofit button?
>
>
>>Luc,
>>
>>Then perhaps you want to turn off AutoFit all together, and just call your column sizing code each time the grid is regenerated? This could be done with the property.
>>
>>>I'm using a grid that is dynamic, it rebuilds itself and I want to set columns width just after the Autofit() method. This way the columns won't change size once the grid is regenerated.