You don't need BindEvent(). This was doable in VFP3/5 days when BindEvent() didn't exist. Simply edit your custom grid to use custom header. Then you would write your code into a single header class. For a sample you can download my MultiselectGrid class:
Download #
9361Cetin
>I inherited a custom grid class. The definition of the grid shows a ColumnCount of 30. Three methods of
EACH column in the grid have code in them.
>
>
>The MouseDown code for the Header of each column is
>
>LPARAMETERS nButton, nShift, nXCoord, nYCoord
>This.Parent.Parent.origcolnum = this.Parent.ColumnOrder
>
>The Click code for the Header of each column is
>
>IF this.Parent.Parent.origcolnum = this.Parent.ColumnOrder
> this.Parent.parent.SortGrid(this.Parent)
>ENDIF
>
>The DblClick code for the TextBox inside each column is
>
>this.Parent.Parent.filtercolumn=this
>this.parent.parent.DblClick()
>
>We've run into a situation where the ColumnCount for the grid needs to expand beyond 30 columns. Our "solution" is to expand the numbe of columns (to 50) and put this code into each new column's header/text box. This solution works and is therefore, by our definition, acceptable and has been implemented.
>
>OTOH, it seems to me that there should be a better solution by taking all this code out of the column header and text box and somehow using BINDEVENT() to get everything working. I don't have enough familiarity with BINDEVENT to do this and my (admittedly meager) efforts have been fruitless.
>
>Could somebody please provide some guidance on
>
>1. Is BINDEVENT a reasonable way of attaching code to the header/textbox of each column in the grid
>
>2. Coding technique for actually getting it done
>
>3. If the form reduces ColumnCount and later expands it, will all the columns still be "bound"
>
>4. If not is there an _ASSIGN method (or something else that doesn't have to be coded in the application) for ColumnCount where I can rebind all the columns?
>
>I hope this is comprehensible.........
>
>Thanks to all.............Rich