Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is it possible to add codes to methods at runtime?
Message
De
17/09/2004 06:47:40
Metin Emre
Ozcom Bilgisayar Ltd.
Istanbul, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00942377
Message ID:
00943252
Vues:
37
Thank you Terry. A hook didn't come my mine. Martin Jindra said that too. And he said another alternative "bindevent". I understand why bindevent added now. :)

>>I think so need more explanation. I want to create a grid at runtime and fill its columns events at runtime. I know I can do anything with execscript but how I can tie that to an event?
>>
>Paste this code in a prg and run it. When the textbox looses focus, the messagebox() commands will fire. Remove the "*" from the backcolor code. Select the textbox again and force the lost focus. After the messageboxes fire, the form background color will change to blue.
>
>You can put the code in a memo field or a regular field in a dBF. You can even store the "COMMANDS" in an array!
>
>
>ON ERROR do prgError
>PUBLIC frmExeScript
>frmExeScript=CREATEOBJECT('subForm')
>WITH frmExeScript
>.addobject('txtText1','text1')
>.addobject('edtEdit1','Edit1')
>.SHOW
>ENDWITH
>READ events
>CANCEL
>
>DEFINE CLASS Text1 as TextBox
>top=20
>width=200
>left = 20
>PROCEDURE lostfocus
>IF !EMPTY(thisform.edtEdit1.Value)
>   EXECSCRIPT(thisform.edtEdit1.value)
>ENDIF
>ENDPROC
>visible=.t.
>ENDDEFINE
>
>DEFINE CLASS Edit1 as EditBox
>top=60
>height=120
>left=20
>width=300
>value="messagebox([Execute Script Line 1])"+CHR(13)+;
>      "messagebox([Execute Script Line 2])"+CHR(13)+;
>      "*frmExeScript.backcolor=RGB(0,0,255)"
>
>visible=.t.
>ENDDEFINE
>
>DEFINE CLASS subForm as Form
>visible=.t.
>PROCEDURE release
>this.QueryUnload
>ENDPROC
>PROCEDURE queryunload
>CLEAR EVENTS
>ENDPROC
>caption=[Lostfocus in text box will fire code in edit box]
>ENDDEFINE
>
>PROCEDURE prgError
>ON ERROR
>MESSAGEBOX([Error])
>ON ERROR do prgError
>ENDPROC
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform