Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I don't want TILE effect on my Picture
Message
 
 
À
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:
00505664
Vues:
23
Hi!

I did some experimenting and figured out that it is possible to define methods for SCATTER NAME object, but is not possible to define events. I figured out also that you cannot define ACCESS and ASSIGN methods this way, for example, to track field changes in that objects. Programmatic code for ACCESS and ASSIGN could be defined and works only if they already defined in the class used for original object, that you can override them programmatically. When they're not defined, you can define them programmatically, but they do not work as expected.

Frustrating...

Anyway, with some limitations, ths could be considered as an approach to define some code for some object's existing method/event in run-time.

Fred, it worth an article or at least FAQ!

>>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.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform