>Dear Friends,
>
>I have created a form with a grid which is being filled in at run time during the load method of the form. At design time the grid is empty and columncount = -1.
>
>Now I want to assign a click method to each header, so that when you click on the header it will sort the data inside on ascending or descending order.
>
>How can I do that? Setall does not work for methods and there is no header or grid yet when I design the form.
>
>Any ideas are welcome.
>
>Thanks in advance
>
>Jonathan Feldman
Jonathan,
Best is to (1) Subclass the header, (2) in the grid.init() replace the standard headers with your header (copy all properties from the old header to the new one like font, caption, ...)
The most flexible is to 'forward' the header.Click()/Mousedown/Mouseup/.. to the grid. ie add methods to your grid class like Header_MouseUp, ...
Your grid base class can have a standard way of reacting. In addition, each grid can override the header clicks
eg
procedure MouseDown
LPARAMETERS nButton, nShift, nXCoord, nYCoord
do case
case (nButton == BUTTON_RIGHT )
NODEFAULT
=this.Parent.Parent.Click_Right_Header(this.Parent)
...
endcase
endproc
Gregory