Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP bug, and how to fix it
Message
De
04/03/2023 01:31:09
 
 
À
03/03/2023 16:49:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
01686313
Message ID:
01686323
Vues:
49
>>Hi folks,
>>
>>For several weeks now I have been working on a Thor utility which will be available soon. This tool uses many Foxtools functions which are exposed in an object typically called loEditorwin, check https://github.com/VFPX/PEMEditor/blob/master/Documentation/pemeditor_editorwindow_object.md for details.
>>
>>My work has been delayed for a long time since the program failed occasionally, and seemingly with no pattern for when and how it failed. The errors were incomplete, inconsistent and the debugger didn't provide any help either.
>>
>>The program copies data programmatically back and forth between the editor and the clipboard, and manipulates it in between. But sometimes some of the data "disappeared" for no reason I could explain, and it made me lose my mind, and much of my hair...! :-)
>>
>>I was ready to give up, but as a last resort I tried to add a short delay. Lo and behold, that fixed it! And now I want to share it with all of you.
>>
>>To reproduce the error, try the following code:
>>
>>
>>_cliptext=''
>>For lnX = 1 to 10
>>*  Wait Window '' timeout 0.001
>>  _cliptext = _cliptext + Transform(lnX) + Chr(13)+Chr(10)
>>Endfor
>>Wait Window _cliptext
>>
>>
>>Run it several times, and you will notice that sometimes the list of numbers isn't complete, and sometimes it is.
>>
>>Now remove the comment (*) and run it again. Now you will get the correct result every time!
>>
>>Conclusion: VFP needs some time to "settle" when you move data to and from the clipboard. A very small delay won't be noticeable, but it will fix the problem!
>
>Instead of WAIT WINDOW could you try DOEVENTS?

I will do many more tests during the weekend, and report back. I really need to find the root of the problem.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform