Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I don't want TILE effect on my Picture
Message
De
08/05/2001 12:54:52
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Photos et traitement d'images
Divers
Thread ID:
00503869
Message ID:
00504826
Vues:
23
>Hi!
>
>Late binding for VFP object events, right?
>
>Very nice tip. Why not make a feature in VFP 7 to bind VFP code to the events of COM/ActiveX objects by the same way? I just tried to do this in VFP 7 and had no luck. For example, no way to add COM object to the VFP comntainer. When making it as aproperty of the container, I can define a method for the object assigned to thet property (!), however, cannot bind code to the COM object/ActiveX event (when can do this for VFP object).

I've only begun experimenting what can be done with this method. But it indeed is very powerful.

>Code example:
>
>
>_Screen.AddProperty("oo")
>_Screen.oo = createobject("ADODB.Connection")
>_Screen.NewObject("oSH", "ScreenHook")
>_Screen.oo.Open("DSNConnection","User","Password")
>_Screen.oo.WillConnect("Something...")
>
>DEFINE CLASS ScreenHook AS CUSTOM
>o = _Screen.oo
>PROCEDURE o.WillConnect()
>lparameters pConnectionString, pUserID, pPassword, pOptions, padStatus, ppConnection
>  *
>  * Code to handle the main VFP screen being resized
>  *
>  WAIT WINDOW NOWAIT "Connecting... " + pConnectionString
>ENDPROC
>ENDDEFINE
>
>
>Strange, but code runs without errors. WillConnect Event of the ADO Connection object is not fired by ADO. However, you can call that method directly from VFP.

I've not tried to bind any ActiveX controls in this manner, but it's no real surprise that it doesn't work. It would be really neat if it did, though.

>
>I guess it is not a problem in VFP 7 to make such binding to events.
>
>Defining a method in run-time for any object is interesting. This also gives an interesting idea to organize wrapper around 'Scatter ... Name' object in VFP. And, of course, to do some strange hooking of such objects like window defined by DEFIUNE WINDOW .. NAME, Browse ... Name etc. I guess this approach is also very valuable for grids, specially for such hooks like grid highliters ;) Note that events work even for objects assigned as a property. Example:
>
>
>lcObjectPath = "_Screen.ot"
>_Screen.AddProperty("ot")
>_Screen.ot = CreateObject("TextBox")
>_Screen.NewObject("or", "ScreenH")
>_Screen.ot.Value = "Something"
>
>DEFINE CLASS ScreenH AS CUSTOM
>oRS = eval(lcObjectPath)
>PROCEDURE oRS.ProgrammaticChange()
>  *
>  * Code to handle the main VFP screen being resized
>  *
>  WAIT WINDOW NOWAIT "!!!!!!!!!!"
>ENDPROC
>ENDDEFINE
>
>
>In above code ProgrammaticChange event of the textbox fired correctly. As you see, you can make such hooks universal by passing an object to them as expression.
>

Does a SCATTER NAME object have any events associated with it, besides Access/Assign for the fields? I'll have to give this a try. I know George Tasker had pointed out you could do one of those on a SCATTER NAME object, but both didn't seem to work.
Fred
Microsoft Visual FoxPro MVP

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

Click here to load this message in the networking platform