Nadya,
The builder would look something like:
aSelObj(laObjects)
FOR EACH loObject IN laObjects
IF UPPER(loObject.BaseClass) # "GRID"
LOOP
ENDIF
FOR EACH loColumn IN loObject.Columns
FOR EACH loColObject IN loColumn.Controls
IF UPPER(loColObject.BaseClass) # "HEADER" OR ! EMPTY(loColObject.ReadMethod("Click"))
LOOP
ENDIF
loColObject.WriteMethod("Click","this.parent.parent.setorder(this,this.parent.controlsource)")
ENDFOR
ENDFOR
ENDFOR
The aSelObj takes all selected objects and places them in the laObjects array
For each object, check if it is a grid. For each grid, take each column and find the Header. In each header, check the Click method for code. If empty, add the call to the Grid.SetOrder method in the Click method.
That's all there is to it
HTH
Rex
>Rex,
>
>Could you please give me some clarification, how to do this, because I've never did it before? I just put this code directly on the grid.header Right Click event on each column on my form.
>So, I'm really interested in more general approach.
>
>>>two options you have are
>>>create a grid with more columns that you need (i.e. max number of columns you use) and remove column in run-time
>>>the second is to create the class definition for the column, header etc. in code (in a PRG) and add them in run-time
>>>
>>>Arnon
>>
>>Third option is to create a builder and run it against the grid
>>
>>HTH
>>
>>Rex