> > Hi my friends.
> > In a recent thread about sorting a grid by header clicks, I posted a way I used to do that.
> > I improved it a little bit and posted a sample form in my blog with some explanation of the procedure.
> >
> > It may be useful to some of you.
> >
> >
My Foxite Weblog> >
> > sample form to download:
> >
http://www.foxite.com/uploads/5c545b64-b731-4c6f-bae4-4e20ed0c6c5b.rar> >
> > sample form picutre:
> >
> >

> >
> > Best regards.
> >
> > Ammar Hadi ................IRAQ
> >
> > ---------------
> > I I I really love foxite
> > ___________________________
>
> Hi Ammar and thanks for sharing your code.
> i just have one remark: you repeat pratically the same code in all click event of the headers (safe the numero of index).I recommend you to work with bindevent in any click on any header,if concerned by the sorting.try this code:
>
> in form.init add
>
> for i=1 to this.grdsort.columncount
> if inlist(i,1,2,3) &&choice only the column to sort asc/descending-grid can have any columnCount
> aa="this.grdsort.column"+trans(i)+".header1"
> bindevent(&aa,"click",thisform,'ybind')
> endi
> endfor
>
> and create a method "ybind" with this code
>
> x=sys(1270)
> n=val(right(allt(x.name),1))
>
> SELECT tempStudents
> IF VAL(SYS(21))<>n && current index number
> SET ORDER TO n IN tempStudents
> ELSE
> IF DESCENDING(n,"tempStudents")
> SET ORDER TO n IN tempStudents ASCENDING
>
> ELSE
> SET ORDER TO n IN tempStudents DESCENDING
>
> ENDIF
> ENDIF
> THIS.grdsort.SETALL("picture","","HEADER")
>
> y="this.grdsort."+allt(x.name)+".header1.picture"
> &y=IIF(DESCENDING(n,"tempStudents"), THISFORM.picdesc, THISFORM.picace) && the sorting icon
>
> GO TOP IN tempStudents
> THIS.grdsort.REFRESH
> THIS.grdsort.SETFOCUS
>
> with this you can generalize to any grid with any columncount.
> I see this remarkable opportunity in Listview controls and even in subclass of grids.
>
>
> Dont rate please.its only for the pleasure to help.Give me only a feed back.
> Yousfi Benameur
Thanks for your note Yousfi.
I thought about using 1 method in the form to control it, but I admit that bindevent() flied away from my head at that moment. Bindevent() is definitely a more professional choice.
Thanks for sharing your ideas too.
Ammar Hadi ................IRAQ
My Foxite Weblog---------------
I I I really love foxite
___________________________