>>>Is there a way to set a method at runtime, like Setall() for properties?
>>There is no direct way. You should loop through the controls and explicitly execute the method.
>
>I need the Mousemove event of all columns in all grids to have a specific code snippet. The ideal way to do this is ofcourse through inheritance (classes), but I build my grids visually through the form builder, which doesn't allow the grid columns to inherit from another class than the VFP base column class. Is there a way around this?
Vidar,
There is a workaround but might be painfull if you don't design for it from the beginning. You could build the grid with your own builder.
A simpler way till a builder is available is follows (an extremely simple builder) :
lparameters tcMethodName, tcMethodCode
ASELOBJ(oGrids)
FOR each oGrid in oGrids
IF !oGrid.baseclass = "Grid"
LOOP
ENDIF
FOR each oColumn in oGrid.columns
oColumn.WriteMethod(tcMethodName, tcMethodCode)
ENDFOR
ENDFOR
ie : Put grid(s) on a form and build as normal. Select one or more grids, go to command window :
=gridcols("MouseMove","wait window this.name nowait")
Now the other side of the coin. Grid columns wouldn't have the mousemove event easily despite you all change columns' code. Mouse events change focus when a grid control has already focus and not have focus yet. ie: Mousemove events would work when grid doesn't have focus at all, or activecontrol is a grid control with column = 5, row = 4. Mousemove would work for all the columns again except it wouldn't work when mouse comes over selected control (column5, row4). This shouldn't be much problem though.
And this is only for mousemove, do not take this explanation for all mouse events (ie: click).
Cetin