Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid Clicking on Column Header function
Message
 
 
À
27/09/2004 19:45:57
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00946470
Message ID:
00946485
Vues:
17
>>I need to change sorting of records when user clicks on a column header of a grid. As far as I know how to do it, you have to replace "Header1" from the column object and replace it with your own custom object. The problem I am having is that it works when grid has no columns and you build it from "scratch."
>>
>>But I am trying to make it work on an existing grid (that is, grid build in the designer). So when I run the following code in the INIT method of the form:
>>
>>
>>for each loColumn in thisform.grid.columns
>>	loColumn.RemoveObject( "Header1" )
>>	loColumn.AddObject( "Header1", "custom_header" )
>>endfor
>>
>>
>>I get error on the line .AddObject. I am using VFP 6.
>>
>>Does VFP 8 grid have functionality that would allow me to make this work on an existing grid (that is, without having to build grid in the INIT method)?
>
>It would help if you said which error are you getting. I don't remember whether I've done that in 6, or started with 7, but I think you don't need the removeobject line. If you watch it in the debugger, the moment you remove the header, a new one is inserted instead of it. But when you add a header, the old one is automatically removed.
>

The error is "Object Name is Invalid", when trying to add object "custom_header."

>This exceptional behavior of columns with headers is quite opposite from what it does with other controls - you can add them as you like, and if you want your control to be the one, you need to add it first, then remove the original one. If you remove the old one first, it's reincarnated (well, just like it does with the header - sometimes I think VFP grids come from those horror movies where the monster just keeps getting revived, really hard to kill).

<g>.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform