Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sort on Form Init
Message
De
12/12/2008 14:37:25
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Divers
Thread ID:
01366984
Message ID:
01367037
Vues:
7
I've snipped some code that doesn't quite seem right..........
SELECT fac_mas
SET ORDER TO operator
GO TOP
   .
   .
   .
 *** We are at the top, remember GO TOP command :-)
thisform.cmdback.enabled = .F.
thisform.cmdbeg.enabled = .F.
IF (RECNO() == RECCOUNT())
   *** That is just in case you have only one record in the table
Wouldn't this also be true if the last physical record is the first indexed record? Better, I think, is something like
SKIP
IF EOF()  && only one record in table
etc.
>>Here is what I entered into the Init. Everything after my set order to statement just pertains to buttons being enabled or not to allow parsing. This SET ORDER TO operator did not seem to do anything. Did I not do it correctly? This table is in fact in the Data Environment. I went in there but am unsure on how to set an order in there.
>>
>>
>>ThisForm.DtKeyPress = DATETIME()
>>ThisForm.dtMouseMove = DATETIME()
>>SELECT fac_mas
>>SET ORDER TO operator
>>IF m.swid = " "
>>	thisform.txtcount.value = Recno()
>>	thisform.txttotal.value = Reccount()
>>
>>	IF (recno() == 1)
>>		thisform.cmdback.enabled = .F.
>>		thisform.cmdbeg.enabled = .F.
>>	ENDIF
>>
>>	IF (RECNO() == RECCOUNT())
>>		thisform.cmdforward.enabled = .F.
>>		thisform.cmdend.enabled = .F.
>>	ENDIF
>>ELSE
>>	thisform.txtcount.value = Recno()
>>	thisform.txtcount.ReadOnly = .T.
>>	thisform.txttotal.value = Reccount()
>>
>>	thisform.cmdback.enabled = .F.
>>	thisform.cmdbeg.enabled = .F.
>>	thisform.cmdforward.enabled = .F.
>>	thisform.cmdend.enabled = .F.
>>	thisform.cmdfind.Enabled = .F.
>>ENDIF
>>IF m.movebottom = "YES"
>>	LOCATE FOR sw_id = newswid
>>	m.movebottom = "NO"
>>ENDIF		
>>thisform.refresh
>>
>
>
>
>O! GOD!
>And I suspect you use GO TO operator in Next and Previous buttons.
>If so no matter WHAT order you set the table will be handled with its native ordrer.
>
>Instead of GOTO just use SKIP and SKIP -1 check for EOF() and BOF:
>
>ThisForm.DtKeyPress = DATETIME()
>ThisForm.dtMouseMove = DATETIME()
>SELECT fac_mas
>SET ORDER TO operator
>GO TOP
>thisform.txtcount.value = Recno()
>thisform.txttotal.value = Reccount()
>
>IF m.swid = " "
>   *** We are at the top, remember GO TOP command :-)
>   thisform.cmdback.enabled = .F.
>   thisform.cmdbeg.enabled = .F.
>   IF (RECNO() == RECCOUNT())
>      *** That is just in case you have only one record in the table
>      thisform.cmdforward.enabled = .F.
>      thisform.cmdend.enabled = .F.
>   ENDIF
>ELSE
>   thisform.txtcount.ReadOnly = .T.
>   thisform.txttotal.value = Reccount()
>   thisform.cmdback.enabled = .F.
>   thisform.cmdbeg.enabled = .F.
>   thisform.cmdforward.enabled = .F.
>   thisform.cmdend.enabled = .F.
>   thisform.cmdfind.Enabled = .F.
>ENDIF
>IF m.movebottom = "YES"
>   LOCATE FOR sw_id = newswid
>   m.movebottom = "NO"
>ENDIF		
>thisform.refresh
>
>
>
>Then in "next" button do:
>
>SKIP IN fac_mas
>IF EOF("fac_mas")
>   SKIP -1 IN fac_mas
>   *** disable all forward buttons here
>ENDIF
>
>
>In "Previous" button do:
>
>SKIP -1 IN fac_mas
>IF BOF("fac_mas")
>   SKIP IN fac_mas
>   *** disable all backwards buttons here
>ENDIF
>
>
>In "go to last" button:
>
>GO BOTTOM
>*** disable all forward buttons here
>
>
>In "go to first" button:
>
>LOCATE
>*** disable all backwards buttons here
>
>
>I hate wizards :-)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform