Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing Methods field in MyForm.SCX
Message
From
13/04/1998 10:56:24
 
 
To
12/04/1998 13:38:28
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00090757
Message ID:
00091534
Views:
19
>>But back to your question ... I don’t want to move all the existing WhatEver() method code into the new corresponding MyWhatEver() method manually, so I plan to write a MoveMethodCodeToMyMethod.PRG program, and run it instead against ALL my existing SCX files. I was just checking out whether or not I would be stuck with a mismatched Methods field / ObjCode field in my SCX. (I have since been told by John Petersen that “Compile Form MyFile” will make things right again)
>>
>>If anybody sees a flaw in this approach, or can think of any side effects that should be accommodated, I would appreciate hearing of them.
>
>Nothing much (I'm doing things like that occasionally), just a few tips: beware of uppercase/lowercase slips while serially replacing your strings for your MyStrings in method code. A safe approach could be to find the string using ATC(), then check for characters surrounding it (white space before it, dot or CR or parentheses after), and then actually replace scx.methods with stuff(methods, position, length, newstring) for each occurence of the string. Preferrably, you may use an array to look for positions of all of the occurences of the string, and then replace them last to first, so their positions don't move.

For som reason, I enjoy string manipulation. Thanks for suggesting an approach. I particularly liked the "last to first" idea that would allow the pre-evaluated "position" parameter in your stuff() example to remain correct all the way through.

Bob
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform