Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
List of Object on Form
Message
 
 
To
21/05/2005 10:43:07
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01016458
Message ID:
01016474
Views:
9
Hi Zahid,

Try
* Create object oSomeObject
...
USE IN (SELECT("ObjectList"))
CREATE CURSOR ObjectList ( ;
	Name C(32), ;
	BaseClass C(32), ;
	ObjectHierarchy C(254))
= ObjectList(oSomeObject, "ObjectList")
SELECT ObjectList
BROWSE LAST NOWAIT
...
Function ObjectList
LPARAMETERS toObject, tcCursorName
LOCAL loControl, loPage, loColumn

DO CASE
CASE Type("toObject.ControlCount") = "N"
	FOR EACH loControl IN toObject.Controls
		= ObjectList(loControl, tcCursorName)
	ENDFOR
CASE Upper(toObject.Baseclass) = Upper("Pageframe")
	FOR EACH loPage IN toObject.Pages
		FOR EACH loControl IN loPage.Controls
			= ObjectList(loControl, tcCursorName)
		ENDFOR
	ENDFOR
CASE Upper(toObject.Baseclass) = Upper("Grid")
	FOR EACH loColumn IN toObject.Columns
		FOR EACH loControl IN loColumn.Controls
			= ObjectList(loControl, tcCursorName)
		ENDFOR
	ENDFOR
OTHERWISE
	INSERT INTO (tcCursorName) VALUES(toObject.Name, toObject.Baseclass, ;
		SYS(1272, toObject) )	
ENDCASE
RETURN
It's a sample code only. You'll have to adjust it to your requirements.

>I want a procedure to get list of all ojects on a form with complete reference and save the reference to a DBF.
>Like there are 3 obects on my form.
>1- text1 (a textbox)
>2- combo1 ( a combobox )
>3- button1 ( a commandbutton)
>Form name is form1
>
>i want complete reference like.
>
>obj_ref.dbf with 2 columns ref_name and baseclass
>---------------------------------
>| ref_name | baseclass |
>--------------------------------|
>| form1.text1 | textbox |
>| form1.combo1 | combobox |
>| form1.button1 | commandbutton |
>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform