Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form Release() not!
Message
From
17/04/2002 14:32:25
 
 
To
06/02/2002 17:45:57
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00616105
Message ID:
00646017
Views:
20
>It sounds an awful lot like the problem described, but SP1 is already installed and there are no _ASSIGN's in sight. But still, the last line of the KB describes *EXACTLY* what I'm seeing: "When the form appears, try to close it by using the Close button; you are unable to do so. The only way to close the form is to issue a CLEAR ALL command from the Command Window."
>
>I've subclassed an Olecontrol to create a custom "checklist" control, based on the listview. It's sitting on a very simple form bound to a field in a free table, using a query to populate the list, all done from methods inside my subclass. I have a property called boundfield that I use in place of a control source (REPLACE &boundfield WITH assignments) - there are no _ASSIGN's anywhere. The only object references are the usual this and thisform type stuff, no publics. Listing memory to a file before and after gives the same results.

We have seen an issue where using a FOR EACH for the nodes collection in a treeview ActiveX control causes the form containing it not to release.

Run this code, click the button twice, then try to close the form.
PUBLIC oForm
oForm=NEWOBJECT("frmtest")
oForm.Show
* uncomment to automate
*!*	oform.cmdTest.click()
*!*	oform.cmdTest.click()
*!*	oform.release()
RETURN

DEFINE CLASS frmtest AS form
	ADD OBJECT oletreeview AS olecontrol WITH ;
		Height = 195, Width = 201, ;
		Name = "oleTreeView", ;
		oleclass = 'mscomctllib.treectrl.2'

	ADD OBJECT cmdTest AS commandbutton WITH ;
		Left = 232, Height = 25, ;
		Caption = "Test"

	PROCEDURE init
		FOR lni = 1 TO 5
		      thisform.oletreeview.nodes.Add(, 4, "test"+TRANSFORM(lni), lni)       
		ENDFOR 
	ENDPROC

	PROCEDURE cmdTest.click
	    LOCAL oNode, oNodes

	    FOR EACH oNode In thisform.oletreeview.Nodes
*!*		oNodes = thisform.oletreeview.Nodes
*!*		FOR EACH oNode In oNodes
	    ENDFOR

	ENDPROC
ENDDEFINE
The workaround is to store off a reference to the nodes collection to a variable first, then refer to the variable instead. To implement, replace the FOR EACH oNode In thisform.oletreeview.Nodes above with these 2 lines:
oNodes = thisform.oletreeview.Nodes 
FOR EACH oNode In oNodes
Maybe this is what you are seeing.
Jim Saunders
Microsoft
This posting is provided “AS IS”, with no warranties, and confers no rights.
Previous
Reply
Map
View

Click here to load this message in the networking platform