Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Set Function 10 to ???
Message
De
30/04/2006 09:48:58
Mike Yearwood
Toronto, Ontario, Canada
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01117757
Message ID:
01117888
Vues:
14
Hi Cecil

>I tried to set Function Key 10 to execute the CLICK event of the SAVE button, but failed in the attempt with errors. Has anyone ever done this, that is, execute an event/method on a form? I tried SET FUNCTION 10 TO THISFORM.cmdSAVE.CLICK(); that resulted in a nice error.

Fabio showed how to code the line correctly. You can define these hotkeys in a menu and have the menu visible while your form runs.

ON KEY LABEL is a dangerous practice. If the user hits F10 twice, it will start the process for the first hit, get part way through, start the process again for the second hit, finish the second and then finish the first. You may want to add a flag that suppresses subsequent starts.

Here's proof: Change the values of X and Y in the following depending on your machine speed. In the command window do this:

ON KEY LABEL F10 DO TESTIT.PRG

Hit F10 to start TESTIT.PRG. Once it starts, hit F10 again.

Here's the two programs:
*TESTIT.PRG
?"STARTED TESTIT"
ON KEY LABEL F10 DO TEST1
FOR x = 1 TO 100
  ?"X=",x
ENDFOR x
*TEST1.PRG
?"STARTED TEST1"
FOR Y = 1 TO 100
  ?"Y=",Y
ENDFOR Y
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform