Re: BROWSE: order by column



Dan and Jack,
Thank you gentlemen. I just went to my VFP8 which I use and see that the
BINDEVENT is available in that version so I will "Bite the Bullet" and learn
something new again from you all. This sounds like a better way to do
sorting. Some day I will get out of the old dark ages way of doing things.
Thank you all.
TonySper

"Jack Jackson" <jacknospam@xxxxxxxxxxxxxxx> wrote in message
news:ulck43pt7baporbaujgt0vbt6g62n2n9ti@xxxxxxxxxx
The easiest way to do this in VFP9 is to use BINDEVENT().

You could put a method in your grid class or use one on the form that
will get called when the header is clicked:

BINDEVENT(Thisform.Grid.Column1.Header1, "Click", Thisform,
"GridHdrClick")

In Thisform.GridHdrClick:
nEv = AEVENTS(aEv, 0)
IF nEv > 0
oHdr = aEv[1]
* oHdr is now a reference to the header object
* that was clicked. oHdr.Parent is a reference
* to the column. From that you should be able
* to figure out which column was clicked and
* to execute whatever code you want to change
* the sort order
ENDIF

The Header object has a Picture property. If you set this to a little
icon of an up or down arrow, or anything else you want, it will
display at the edge of the header. You can use this to tell the user
which column is currently sorted, and if it is an ascending or
descending sort.


On Tue, 15 May 2007 15:14:14 -0400, "TonySper"
<tsperduti@xxxxxxxxxxxxx> wrote:

Thats a great idea except I have not ever done that but should figure out
how to do it. I guess there is some command that you could run from
clicking
on the columns but I do not know it as yet. My other problem would be to
inform the user to click on the column to sort by it. I would more than
likely have to put some instructions to the user to do that which would be
no problem. Can you give me an example of code to use or how to have the
program know when I click on a column to run different sorts??
TonySper

"Bernhard Sander" <fuchs@xxxxxxx> wrote in message
news:eciO54wlHHA.2272@xxxxxxxxxxxxxxxxxxxxxxx
Hi Tony,

I converted the browse to a grid on a form and then put commenad
buttons
on the form that the user clicked on to order the grid to any of the
columns. If you have a lot of columns that would be a lot of command
buttons. You could have one command that would open up a screen that
you
would select which column to order by.
If you have already converted the browse to a grid, then you don't need
any command button. Just add the code to change the sort order to a new
method of the grid (or form or your column base class) and call this
method from the header click event.

Regards
Bernhard Sander



.