Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Escape Append From
Message
De
08/04/2003 08:20:22
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00774905
Message ID:
00775036
Vues:
12
Sergey,
You're right. It indeed appears that APPEND FROM is terminated, no matter what the expression in the ON ESCAPE clause is. Since I want to offer the user the possibility to continue, I do something like this:
...
set escape off
append from ... for thermo()
set escape off          && since it will be on when escaped
...

FUNCTION thermo
<show thermometer>

if escapekeypressed()    && As far as I remember, tests lastkey().
   if messagebox( "Cancel operation?", 4+32 ) = 6
       SET ESCAPE ON
       ON ESCAPE *
       keyboard chr( 27 )
   endif
endif
return .t.
Perhaps this is a useful hint for other people.


>Hi Peter,
>
>The code I provided allows user to cancel long APPEND by pressing ESC key. ON ESCAPE is used to set llUserCanceled variable so programm would know if APPEND was completed or was canceled by user. It's not used in APPEND FROM command. If it's the way your code works than I've no idea what you're looking for.
>
>>Chuck, Nadya, Sergey,
>>
>>Thanx. Although...
>>According to the documentation, program execution should resume on the line after APPEND FROM. The result of the ON ESCAPE statement shouldn't even be of influence. However, my experience is that the APPEND FROM simply continues. The only effect that can be arranged is a speedup due to the setting of a variable like llUserCanceled. That same effect was already dealt with in my original code. So, I still don't really have my WHILE effect. There's no problem with small appends, but in my case I have to deal with 10 million record import.
>>
>>Any other suggestions?
>>
>>
>>>Peter,
>>>
>>>Of a top of my head
lcSaveOnEscape = ON("ESCAPE")		&& Save previous ON ESCAPE setting
>>>lcSaveSetEscape = SET("ESCAPE")		&& Save previous SET ESCAPE setting
>>>
>>>SET ESCAPE ON
>>>ON ESCAPE llUserCanceled = .T.
>>>llUserCanceled = .F.
>>>APPEND FROM ...
>>>
>>>SET ESCAPE &lcSaveSetEscape
>>>ON ESCAPE &lcSaveOnEscape
>>>
>>>IF llUserCanceled
>>>	* Process was interrupted by an user.
>>>ELSE
>>>	* Process completed
>>>ENDIF	
>>>>Hi to all,
>>>>
>>>>Who knows a way to abort an APPEND FROM (delimited with tab)?
>>>>
>>>>I've tried to use the FOR clause, but it won't abort. Instead, vfp will continue with the remaining source-records. In this case, I need a WHILE clause, but it's not there.
>>>>
>>>>The SET ESCAPE OFF is not my first thought, since it's an application for endusers.
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform