Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Loosing cursor position
Message
De
08/05/2018 06:35:34
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
07/05/2018 18:49:30
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows Server 2012 R2
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01659809
Message ID:
01659825
Vues:
66
We don't know what that FECHA() and MSG() do. The reason might be hidden there, for example MSG might be calling something that takes focus off the grid and worse off the form and then setting back causing events like activate, gotfocus ... triggered.

Next, let's check what your code is really doing. Second part could be rewritten as:
TEXT to msel textmerge noshow
   update mytable set exam = ?MyCur.CodPetExterno
                   from mytable
                   Where mytable.exame = ?MyCur.nomPeticio
ENDTEXT

Select myBoListE
Scan For myBoListE.gerar = .T.

	MSG(Upper(Alltrim(myBoListE.exam)))

	Select crTemp
	Locate For Upper(Alltrim(crTemp.nomPeticio))  == Upper(Alltrim(myBoListE.exam))
	MSG( "crTEMP : " + Upper(Alltrim(crTemp.nomPeticio)) )


	If !u_sqlexec(m.msel)
		Return
	Endif

	Select myBoListE
Endscan
Select myBoListE
Locate
Don't know what MSG() does. If it is all about displaying the values, your code further be written as:
TEXT to msel textmerge noshow
   update mytable set exam = ?MyCur.CodPetExterno
                   from mytable
                   Where mytable.exame = ?MyCur.nomPeticio
ENDTEXT

Select myBoListE
Scan For myBoListE.gerar = .T.

	_screen.Print((Upper(Alltrim(myBoListE.exam)))

	Select crTemp
	Locate For Upper(Alltrim(crTemp.nomPeticio))  == Upper(Alltrim(myBoListE.exam))
	_screen.Print( "crTEMP : " + Upper(Alltrim(crTemp.nomPeticio)) )


	If !u_sqlexec(m.msel)
		Return
	Endif

	Select myBoListE
Endscan
Select myBoListE
Locate
Removing that display and just thinking about functionality it become:
TEXT to msel textmerge noshow
   update mytable set exam = ?MyCur.CodPetExterno
                   from mytable
                   Where mytable.exame = ?MyCur.nomPeticio
ENDTEXT

Select myBoListE
Scan For myBoListE.gerar = .T.
	If !u_sqlexec(m.msel)
		Return
	Endif
Endscan
Locate
Which could be written as:
TEXT to msel textmerge noshow
   update mytable set exam = ?MyCur.CodPetExterno
                   from mytable
                   Where mytable.exame = ?MyCur.nomPeticio
ENDTEXT
Select myBoListE

local array laCount[1]
local ix
Select count(*) from myBoListE where gear into array laCount

for ix=1 to laCount[1]
	If !u_sqlexec(m.msel)
		Return
	Endif
Endscan
I don't have an idea why you would want to try executing that m.msel N times.
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform