Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
List of Object on Form
Message
From
21/05/2005 13:53:10
 
 
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:
01016502
Views:
10
>Dear
>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 |
>
>thanks in advance
>
>Zahid Mashhood

Put this Button into a form,
set structuretype = 1 (Bylevel) or 2 (ByMember)
RUN AND CLICK
**************************************************
*-- Class:        formstructure
*-- ParentClass:  commandbutton
*-- BaseClass:    commandbutton
*-- Time Stamp:   05/21/05 08:06:03 PM
*

DEFINE CLASS formstructure AS commandbutton

	structuretype = 1

	autoSize = .T.
	Caption = "Structure"

	Name = "formstructure"


	PROCEDURE structure
		LPARAMETERS objectRoot,structureType

		CREATE CURSOR FormStructure (ObjectPath C(254) NOT NULL,baseClass C(40) NOT NULL) && replace C(254) with memo field for a big form

		INSERT INTO FormStructure VALUES (SYS(1272,m.objectRoot),m.objectRoot.Baseclass)

		DO CASE 
			CASE m.structureType=1
				PRIVATE oMember,objectNode
				USE DBF() AGAIN IN 0 ALIAS FormStructureAdd
				SCAN
					STORE EVALUATE(ObjectPath) TO objectNode
					IF PEMSTATUS(m.objectNode,"Objects",5)
						FOR EACH oMember IN objectNode.Objects
							INSERT INTO FormStructureAdd VALUES (SYS(1272,m.oMember),m.oMember.BaseClass)
						ENDFOR
					ENDIF
				ENDSCAN
				USE IN FormStructureAdd
			CASE m.structureType=2
				RETURN this.AddMembers(m.objectRoot)
		ENDCASE
	ENDPROC


	PROCEDURE addmembers
		LPARAMETERS objectNode
		PRIVATE oMember
		FOR EACH oMember IN objectNode.Objects
			INSERT INTO FormStructure VALUES (SYS(1272,m.oMember),m.oMember.BaseClass)
			IF PEMSTATUS(m.oMember,"Objects",5)
				=this.AddMembers(m.oMember)
			ENDIF
		ENDFOR
	ENDPROC


	PROCEDURE Click
		this.structure(m.thisform,m.This.structureType)

		BROWSE NOWAIT
	ENDPROC


ENDDEFINE
*
*-- EndDefine: formstructure
**************************************************
Previous
Reply
Map
View

Click here to load this message in the networking platform