Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Articles
Search: 

How to add custom properties to SCATTER NAME-like object for use with GATHER NAME command
Nick Neklioudov, May 29, 2002
Instead of trying to add properties with some third-party tools like ADDPROP5.FLL to the native object created with SCATTER NAME command you may try to approach this problem from the other side. You can replace the native SCATTER command with your own function MYSCATTER which may work on any are...
Summary
Instead of trying to add properties with some third-party tools like ADDPROP5.FLL to the native object created with SCATTER NAME command you may try to approach this problem from the other side. You can replace the native SCATTER command with your own function MYSCATTER which may work on any area and create the object from one of standard VFP classes and use its native .AddProperty method.
Description
Here is the sample of such function:
* myScatter.PRG
myScatterObject = CREATEOBJECT("myScatterObject")
IF !EMPTY(ALIAS())
	lnFields = FCOUNT(ALIAS())
	FOR N =1 TO lnFields
		myScatterObject.ADDPROPERTY(FIELD(N), EVAL(FIELD(N)))
	ENDFOR
ENDIF
RETURN myScatterObject && Always return an object, so GATHER command could not choke.

DEFINE CLASS myScatterObject AS SESSION
* You may use any VFP class directly like myScatterObject = CREATEOBJECT("Session")
* But you may optionally use this DEFINE CLASS 
* and declare the native PEMs here as HIDDEN if you want, so they are not exposed 
* in case you are using class other than Session or work with VFP version prior to VFP 7.0
ENDDEFINE
Then you go to the record you need like:
SELECT mytable 
* position on desired record here
scattered1 = MYSCATTER() && This is instead of SCATTER NAME...

* .... && more code here

* Now add a property using the native AddProperty method and assign any value to it.
scattered1.addProperty("newPropertyName", "This is the new property value")

SELECT othertable
GATHER NAME scattered1 MEMO 
Note that you still can use the native GATHER command here. The scope of scattered1 variable and other code safety features are up to you. Keep in mind also that the FoxPro reserved words (commands, function names and PEMs names) should not be used as the field names.
Nick Neklioudov, Cgi Group Inc.
Nick Neklioudov, M.Sc., CNA, works as Senior Analyst with CGI Group Inc. in Halifax, Nova Scotia, Canada. Programming in all versions of FoxPro/VFP since 1987, in .Net since 2003, not counting some other developer tools and environments. Nick received Microsoft Most Valuable Professional award three times. Nick Neklioudov has over 20 years experience with computers and information technologies, especially in database-oriented programming, object-oriented programming and information systems development.
More articles from this author
Nick Neklioudov, January 1, 2006
Nick Neklioudov resumes the highlights in the VFP community in the last month
Nick Neklioudov, February 1, 2006
Nick Neklioudov resumes the highlights in the VFP community in the last month
Nick Neklioudov, March 1, 2006
Nick Neklioudov resumes the highlights in the VFP community in the last month
Nick Neklioudov, April 1, 2006
Nick Neklioudov resumes the highlights in the VFP community in the last month
Nick Neklioudov, May 1, 2006
Nick Neklioudov resumes the highlights in the VFP community in the last month
Nick Neklioudov, June 1, 2006
Nick Neklioudov resumes the highlights in the VFP community in the last month
Nick Neklioudov, July 1, 2006
Nick Neklioudov resumes the highlights in the VFP community in the last month
Nick Neklioudov, August 1, 2006
Nick Neklioudov resumes the highlights in the VFP community in the last month
Nick Neklioudov, September 1, 2006
Nick Neklioudov resumes the highlights in the VFP community in the last month
Nick Neklioudov, October 1, 2006
Nick Neklioudov resumes the highlights in the VFP community in the last month
Nick Neklioudov, November 1, 2006
Nick Neklioudov resumes the highlights in the VFP community in the last month
Nick Neklioudov, December 1, 2006
Nick Neklioudov resumes the highlights in the VFP community in the last month
Nick Neklioudov, March 1, 2007
Nick Neklioudov resumes the highlights in the VFP community in the last month
Nick Neklioudov, June 23, 2000
You can make your form Modal/Modeless on the fly. This may be useful for preventing users to switch to other forms before they finished entering the data.
Nick Neklioudov, April 7, 2000
This will translate the HEX encrypted text. It is a little wrapper around George Tasker class for automatic translation back and forth and placing the translated text to the Clipboard. You can explicitly pass your text as a parameter, or the program automatically picks the clipboard content.
Nick Neklioudov, April 5, 2000
Checkboxes supports both Numeric and Logical data types. When you check its value, do not just write IF thisform.mycheckbox.Value = 1 or IF thisform.mycheckbox.Value = .t. Check it as IF !EMPTY(thisform.mycheckbox.Value) This way you don't care what the type of value really i...
Nick Neklioudov, June 26, 2000
Say, you have the client birth date and you want your program to tell you if the birthday is within the certain date range (even when the given range starts in one year and finishes in another). SELECT * FROM CLIENTS ; WHERE BETWEEN(GOMONTH(birth_date,(YEAR(start_date)- YEAR(birth_date))*12), st...
Nick Neklioudov, November 1, 2001
I live in Halifax, Nova Scotia with my wife Tanya (who I happily married 22 years ago) and our 18-year old daughter Nadya. The 3-year old cat Stanley is also a family member :) As you might have guessed, I do VFP programming. Tanya works at Dalhousie University. She is Ph. D. in Biology and has bee...
Nick Neklioudov, November 1, 2002
Author: Whil Hentzen Publisher: Hentzenwerke Corporation ISBN: 193091900X Paperback: 548 pages Dimensions (in inches): 1.14 x 9.10 x 7.02 3rd edition (July 2002) Amazon link: http://www.amazon.com/exec/obidos/tg/detail/-/193091900X/qid=1033007807/sr=8-3/ ref=sr_8_3/1...
Nick Neklioudov, July 17, 2000
If you get an error "Expression is invalid. Use a valid expression for DYNAMIC... property" you may try different type of addressing your PEMs: For example, in Grid.Init() this syntax does not work this.SETALL('DynamicBackColor', 'IIF(ASCAN(This.Parent.aRecNosSelected,RECNO()) > 0, RGB(255,0,...
Nick Neklioudov, January 17, 1998
This works: this.column1.DynamicForeColor = "IIF(some_type = 2, RGB(255,0,0), RGB(0,0,0))" And this does not work: this.column1.DynamicForeColor = "IIF(some_type = 2, RGB(255,0,0), RGB(0,0,0)) " Reason: one extra space before closing quotes.
Nick Neklioudov, January 1, 2001
I believe all of us are familiar with that set of four navigational buttons "First", "Prior", "Next", "Last" we use for data entry or maintenance forms. You need to put some code in their Click() events, enable or disable navigation buttons, according to the position of record pointer in a table. ...