Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Indexs and Grids!
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00307445
Message ID:
00307457
Vues:
41
>Hi,
>
>I have a form that has a Grid (empty!). After the user choose some sentences, i create a cursor with the result from a query made to SQL Server. With RecourSource, i "put" the cursor at the Grid. Perfect!!!
>But, i would like to do this:
>
>1 - Create indexs to each column of the Grid(to allow the user click on the header, and sort by that field). Is this possible to make to a cursor?
>
>2 - How do i associate code to my Click event of the header of the Grid... before she gets created?!?! As my view is blank, i cannot associate code to columns (because she doesn't have it!). Is there any way i can add code to my Click event, when i'm creating the Grid?
>
>Thanks,
>
>Ricardo

As long as your return cursor is not Table buffered, you can create an index with the command INDEX ON SOMEFIELD TAG SOMETAG. This creates a CDX file with the same temp name as the results cursor. So the CDX will disappear along with the temp DBF file when you close the cursor.

As for code to change the sort order when you click a column header is going to be a problem. You will not be able to leave the ColumnCount property at -1. You will have to set the column count to however many columns you need.

In my grid class, I have a custom method called mHeaderClick. I pass 1 parameter to this method from the actual header click method. In the header click method I have the following code: This.Parent.Parent.mHeaderClick("OrderTagName"). My mHeaderClick code looks something like:
lparameter lcOrder
if pcount() = 0 or vartype(lcOrder) <> "C"
   return
endif
if empty(This.RecordSource)
   return
endif
if upper(order(This.RecordSource)) = upper(lcOrder)
   return
endif
set order to (lcOrder)
This.Refresh()
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform