Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I release those objects?
Message
 
To
27/05/2014 16:02:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01600733
Message ID:
01600746
Views:
69
Likes (1)
Hi Denis,

You need to use the method RemoveObject, below I show you a quick and dirty sample:
loForm			= CREATEOBJECT('myForm')
loForm.Show(1)

DEFINE CLASS myForm as Form
	width = 603
	height = 100
	myObjects = 20
	ADD OBJECT cmdRemove as CommandButton WITH Left = 260, Top = 80, Width = 60, Caption = 'Remove!'
	
	FUNCTION Init() as Boolean
		LOCAL lnObject, loText
		FOR lnObject = 1 TO thisform.myObjects
			thisform.NewObject('txt' + TRANSFORM(lnObject, '@L 999'), 'TextBox')
			WITH GETPEM(thisform, 'txt' + TRANSFORM(lnObject, '@L 999'))
				.Width		= 30
				.Left		= ((lnObject - 1) * .Width) + 1
				.Top		= 5
				.Value		= lnObject
				.Visible	= .t.
			ENDWITH
		ENDFOR
		RETURN .T.
	ENDFUNC
	
	PROCEDURE RemoveButtons() as VOID
		FOR lnObject = 1 TO thisform.myObjects
			thisform.RemoveObject('txt' + TRANSFORM(lnObject, '@L 999'))
		ENDFOR		
		RETURN NULL
	ENDPROC 

	PROCEDURE cmdRemove.Click() as VOID
		thisform.RemoveButtons()
		RETURN NULL
	ENDPROC
ENDDEFINE
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Reply
Map
View

Click here to load this message in the networking platform