Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sort Grid by Column?
Message
From
10/02/1999 13:23:45
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00185978
Message ID:
00186114
Views:
19
This is false. The fact is that you cannot visually subclass headers, so your subclassed headers cannot be added to the grid class at design time.

My grid class has a custom property (two actually) called HeaderClass and HeaderClassFile. In the init of my grid, I check to see if the HeaderClass property has been set, and if it has, I loop through the columns in the grid, and REMOVEOBJECT the old header (first storing its vital properties- caption and such), and ADDOBJECT the new header from the specified header class, subesequently restoring the properties taken from the old header.

My subclassed header has a custom property called SortTag that it uses in its click method, where it calls the grid's Sort method using the SortTag as a parameter. The grid takes care of all of the sorting business.

The grid is responsible for setting the headers' SortOrder property after the new headers have been added. It does this by checking for index tags that match the controlsource of each column, and if found, setting the property. There are lots of other little details/ features, but you get the picture. Let me know of you would like a smidgen of sample code.

It is a little old, and I have greatly refined my strategy since, but you might want to look at my article here in the KB called 'Ideas for a better grid' or something like that.



>Nancy,
>Ed said in his reply that you can't subclass headers. Do you know this to be false?
>Rich.
>
>>Hi, Nigel-
>>This may qualify as "too much code," but could you add a method called sort() to your grid (or subclass the grid header). In the header's click you could call the method. Then the method could first look for an index for the controlsource. If there isn't one create a dynamic index and set order to it?
>>
>>HTH
>>
>>>>>Is there any way to display a grid sorted by column - dynamically.
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform