Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cursor in a grid
Message
De
07/03/2007 07:33:42
 
 
À
07/03/2007 07:20:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01201093
Message ID:
01201406
Vues:
33
...
>>>>This has raised some intersting issues:
>>>>
>>>>1. The initial dummy select - doesn't that belong in a different method? Otherwise it would be getting created again, anyway, every time you call the method to refresh the grid with the newly selected data?
>>>>
>>>>2. You talk about the extra code necessary (presumably to "shape" the grid.) but where does the grid formatting, and field-to-grid column allocation happen, if you don't select the data in the order in which it should appear on the grid.
>>>>AFAIC see, you have to do that anyway.
>>>>
>>>>Terry
>>>
>>>First of all, this discussion is maybe irrelevant if you always create the grid "on the fly". Personally I usually create grids from a temporary table with the same name as the cursor I create in the application, and I do it visually in the form designer. This also mean that I usually move some fields, resize them, and so on.
>>>
>>>1. Yes, persoanlly I have code like "Select * from myfile where .F. into cursor mydummy readwrite" in the form's load event, so that I have a cursor to bind the grid to.
>>
>>That's where I supposed it should go - doe once then done with.
>>
>>>
>>>2. As mentioned, I do that in the form designer. Some of my grids are very complex, with many calculated fields and so on.
>>
>>Yes, my formatting, including the inclusion of several checkboxes, 2-line headers, et al is done in the form designer. Now, despite all the "safe cursor" advice, the only code I seem to need, in the "get the grid's cursor" method is:
>>
>>
>>With thisform
>>  .pgfMainPageFrame.Page3.grdJnyStage.RecordSource = ""
>>
>>* The select gets the fields into the right order for the grid
>>* ____________________________________________________
>>  Select IIF( Journey = "Y", .T., .F.) as lAllJourneys, ;
...
>>  	IIF( Sun 	   = "Y", .T., .F.) as lSun, ;  		
>>  	Start_Date, End_Date ;
>>    from  JNYSTAGE ;
>>    where OPERATOR = lnOperator ;
>>    and	 ROUTE	 = lcRoute ;
>>    and	 MCL_RTE	 = lcMCL_Rte ;
>>    into cursor csrRoutesStages ReadWrite
>>
>>  With .pgfMainPageFrame.Page3
>>    With .grdJnyStage
>>      .RecordSource				= "csrRoutesStages"
>>    EndWith
>>  EndWith
>>EndWith
>>
>>
>>What would be the drawbacks of this scenario?
>
>If it works, there is no drawback. "If it ain't broke, don't fix it". But in other scenarios you may find that this will cause problems, and you must use the "safe select" solution. Personally I wasted two or three days a few years ago, trying to use the recordsource='' solution, until I saw the "safe select" solution which worked perfectly, and had no side effects.

Acknowledged. OTOH, I still don't see how the "safe method" would get all the fields into the correct order for the ready-designed grid
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform