Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid Class and custom header replacement error
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00817621
Message ID:
00817737
Views:
13
Thanks Marcia and Marvin. Here is my latest code, but now I have lost my works in the design mode, ie. the header caption is now gone. Any general purpose way to transfer properties from one to another or I have to use brute force methods to transfer design time properties at runtime?
FOR EACH loColumn IN THIS.COLUMNS
	*** replace the header with custom header class
	*** created in code
	IF !EMPTY(THIS.cHeaderClass)
		SET PROCEDURE TO VSOClasses.prg ADDITIVE

		FOR EACH loObj IN loColumn.CONTROLS
			IF loObj.BASECLASS = 'Header'
				lcName = loObj.NAME

				loColumn.REMOVEOBJECT(lcName)
				loColumn.ADDOBJECT(lcName + "_new", THIS.cHeaderClass)

				loHeader = EVALUATE("loColumn." + ALLTRIM(lcName) + "_new")
				loHeader.NAME = lcName

				EXIT
			ENDIF
		ENDFOR
	ENDIF
...
...
ENDFOR
>I get an error in the AddObject call stating that it is Object Name is Invalid.
>
>First of all, you need to make sure that your prg is available by issuing a
>
>SET PROCEDURE TO < My Prg > ADDITIVE.
>
>Then, try this code instead:
>
>
>IF NOT EMPTY( This.cHeaderClass )
>  FOR EACH oColumn IN THIS.COLUMNS
>    *** replace the header with custom header class
>    *** created in code
>    FOR EACH loObj IN oColumn.Controls
>      IF loObj.BaseClass = 'Header'
>        lcName = loObj.Name
>        oColumn.REMOVEOBJECT( lcName )
>        oColumn.ADDOBJECT( lcName, This.cHeaderClass )
>        EXIT
>      ENDIF
>    ENDFOR
>  ENDFOR
>ENDIF
>
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform