Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Kickin around memory variables?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00510941
Message ID:
00510952
Views:
19
Hi!

1. SCATTER creates the private variables that go out of scope and lost if you finish the method used this command. There is new syntax in VFP 6 for SCATTER command - SCATTER NAME. Make a public object, use SCATTER .. NAME ThatObjectName, than use that object.Field reference as a control sources. There is also GATHER NAME command.

2. m. is required to do not mix the variable with the field name. There is a strange thing in the VFP - when there are memory variable and field in the current alias that have the same name, the field value will be used. When you assign to such name, VFP will try to assign to the field, that, of course, is the most dangerous because VFP does nothing during that - field = value cause no errors and no effect (should be REPLACE command for field to make effect). So, preceeding all variables with m. will make code safe. It is specially useful for SCATTER MEMVAR command becausein this case memory variable name is similar to the field names.

3. This is too specific to answer, need to look to the code of your form, if you did not found answer in the previous paragraph.

HTH.

>I have a form with pageframes. It worked beautifully with buffering. But I dumped buffering and switched to SCATTER MEMVAR MEMO and GATHER MEMVAR MEMO at the request of my leader. Consequently, I am still debugging the form with pageframes. Here are some questions that I am pondering that weren't there before.
>
>1. I thought SCATTER created memory variables from fieldnames, but yet they don't seem to save on a GATHER unless I declare the variables as PUBLIC. I thought SCATTER took care of that for me? Huh?
>
>2. I am confused as to when I need the "m." in front of the variable name. Some references seem to work without it while some seem to require it to work properly. Should I always use m.variable as a rule when using SCATTER/GATHER.
>In all code referencing the field and in all controls Control Source put the "m."?
>
>3. I also noticed that only the top pageframe form fields were saved when I did GATHER MEMVAR MEMO. It seems that the second and third pageframes within the same form had form fields did not save when I did a GATHER MEMVAR MEMO. I suppose if I declare those fields as m.fieldname using PUBLIC fieldname the fields will save properly.
>
>Thanks for helping me to better understand this.
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform