Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a Quick Way to...
Message
From
22/03/2002 16:35:55
 
 
To
22/03/2002 15:02:37
Calvin Smith
Wayne Reaves Computer Systems
Macon, Georgia, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00636233
Message ID:
00636288
Views:
21
>I am faced with the prospect of inserting some code into the dataenvironment before open tables procedure for some 100 odd forms. Is there a quick way I can hack the SCX file to determine which forms use a data environment? Thanks!

You could do something using the Files collection of the Project object, plus builder-type code. I'm thinking of something along these lines (totally untested):

FOR EACH oFile IN _VFP.ActiveProject.Files
IF oFile.Type = "K" && Form
MODIFY FORM (oFile.Name) NOWAIT
MOUSE CLICK AT 1,1 WINDOW (oFile.Name) && This probably needs some adjusting
ASELOBJ(aDE,2)
* Now aDE[1] contains an object reference to the DE
nDEMembers = AMEMBERS( aDE[1], 2)
IF nDEMembers > 0
* There's something in the DE
aDE[1].WriteMethod("BeforeOpenTables",cTheNewCode)
ENDIF
KEYBOARD "{CTRL-F4}Y" && set up close of FD
ACTIVATE WINDOW (oFile.Name) && this'll probably need fixing
ENDIF
ENDFOR

The pieces I'm unsure about are getting a handle on something on the form, and creating the wait state to close the form. The rest should work more or less as written.

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform