>Hi all,
>
>I want add data to a caption off a commandbutton IN A GRID.
>i want dus put a controlsource in this control.
>
>How can i do it ?
>
>ogrid.controls(1) = header
>ogrid.controls(2) = textbox
>ogrid.controls(3) = commandbutton
>
>
>Bindevents ?
>assign property to ctrl source of text2 object
Tricky, to say the least, because even if you set sparse=.t. for that column, it may set the caption to the same value for all rows. One trick I learned from Martina (or was it Martin Haluza?) is to introduce a dynamicfontbold_access method, which would fire before any refresh, and within that method to manipulate other properties of a column. In there, you could do .commandbutton.caption=[whatever you want].
Alternately, you could, in grid's .init(), do this
bindevent(this.column8.commandbutton, "refresh", this, "myRefresh")
and then in grid.myRefresh, use aEvents() to get a reference to the commandbutton, and then assign its caption to whatever you want.
I've tried both methods, although my goal was to accomplish something else, and I had limited success - it would work most of the time, except when it wouldn't :).