Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Migration form FoxPro 2.6 scatter issue

Status
Not open for further replies.

davidy

IS-IT--Management
Apr 19, 2002
13
NL
Hi,

I have migrated a application from FoxPro 2.6 to VFP 8.0.
There where some issues but they are all solve.
The next step that I wanted to do where recreate all screen again because the structure its now in gives me some problems and it still uses read levels (which are limited).
One part of the program exist out of 2 screens in Foxpro 2.6 I did a scatter at the beginning (which creates M. vars) and a gather at the second screen.
When I try this now all M. vars are gone in the second screen.

How can I do a public scatter without having to define all variables public?

Many thanx
 
Davidy,

Here's a quote from the VFP6 Hackers Guide...
Visual FoxPro appears to fix a "by design" bug in older versions. In FoxPro 2.x, if you SCATTER MEMVAR, then call a routine that makes one of the SCATTERed memvars private and GATHER in that routine, if the called routine contains no assignment to the private memvar, FoxPro would find the memvar in the calling routine and GATHER it even though the PRIVATE declaration should have hidden the memvar in the calling routine. Visual FoxPro respects the privacy of the variable. This change should only create a problem for you if you depended on the old behavior.
...which I think answers your situation.


You could consider using the new NAME keyword - SCATTER NAME MyObj. This creates an object who's properties are the fields of the record you were on when you issued the command.

You would then only need to declare MyObj PUBLIC (although declaring variables public is probably best avoided).

Again a quote from Hackers...
We don't use SCATTER and GATHER much in Visual FoxPro. Instead, we use row and table buffering and work with the fields directly. However, we do know people who use the NAME clause to create "record objects" so that they can write more OOP-y code.

Hope that helps,

Stewart
PS If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top