Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Add events?!
Message
De
06/01/2000 22:09:15
 
 
À
06/01/2000 20:01:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00313888
Message ID:
00314276
Vues:
47
>thx thx~
>then where i should place the class and how should i link up with the button i want?!

This will create a test form with a button "Test" in the middle. The Test button will bring up a MessageNox when Clicked. Use the 'X' in the upper right of the form to return to VFP.
MAIN.PRG

*
* Create MyForm and make it visible
*
oForm = CREATEOBJECT('MyForm')
oForm.Show()
*
* Process Events
*
READ EVENTS
*
* All done
*
MessageBox('Test Complete!')
RETURN
*
* MyForm class
*
DEFINE CLASS MyForm AS FORM
AutoCenter = .t.
Caption = [Press the "Test" button to test it's "Click Event"]
PROCEDURE Init
  *
  * Add MyButton to the form
  *
  this.AddObject('cmdButton1','MyButton')
  *
  * Center it
  *
  WITH this.cmdButton1
    .Top = (thisform.Height/2) - (.Height/2)
    .Left = (thisform.Width/2) - (.Width/2)
    .Visible = .t.
  ENDWITH
ENDPROC
PROCEDURE Destroy
  *
  * Return control to the line in the MAIN.PRG after the READ EVENTS
  *
  CLEAR EVENTS
ENDPROC
ENDDEFINE
*
* MyButton class
*
DEFINE CLASS MyButton AS COMMANDBUTTON
Height = 22
Width = 80
Caption = 'Test'
PROCEDURE Click
  MessageBox('Test')
ENDPROC
ENDDEFINE
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform