Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Treeview and private datasession
Message
De
25/11/2003 09:15:21
 
 
À
25/11/2003 08:35:31
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00853186
Message ID:
00853255
Vues:
26
Hi Agnes,

Thanks. It is my first experience with Treeview and it's all very simple stuff

The form closes normally, it's just the datasession that is left.

I do not iterate through the nodes. I just populate the tv with the root nodes and expand them if needed

I even have even removed the nodes when I got Collapse() event. To no avail.

There surely is a way to avoid the leftover dataasessions. The challenge is to find it. But after two days of struggling, I thought I'd ask ;-)
ie
*NodeClick()
*** ActiveX Control Event ***
LPARAMETERS node

do case
case !node.Expanded
	do case
	case Node.Tag = 'Expanded'
	
	otherwise
		with this.Parent
			=.Populate(Node)
		endwith
		Node.Tag = 'Expanded'
	endcase
	Node.Expanded = TRUE

otherwise
	Node.Expanded = FALSE

endcase

Node = Null  && yes, I even do that
* populate
lparameters Node

local s, obj, sTalk, LockScreen
sTalk = set('Talk')
LockScreen = thisform.LockScreen

LockScreen = TRUE
set Talk Off

s = select(0)
with this

	select (this.RecordSource)

	do case
	case isnull(Node)
		= .Treeview.Nodes.Clear()
		
		scan all for RootNode
			do case
			case !.NodeExists(ParentId)
				obj = .Treeview.Nodes.Add(, , ParentId, rtrim(ParentName), 'NodeClosed', 'NodeOpen')
				obj.ExpandedImage = 'NodeOpen'
				obj = Null
			endcase
		endscan

	otherwise
		scan all for ParentId == Node.Key
			
			do case
			case .NodeExists(ChildId)
				assert FALSE
			
			otherwise
				obj =.Treeview.Nodes.Add(ParentId, tvwChild, ChildId, rtrim(ChildName), 'NodeClosed', 'NodeOpen')
				obj.ExpandedImage = 'NodeOpen'
				obj = Null
			endcase
		endscan
	endcase
endwith
select (s)
set Talk &sTalk
thisform.LockScreen = LockScreen
** NodeExists
lparameters NodeName

local sError
sError = On('error')

private NodeExists
NodeExists = TRUE
on error NodeExists = FALSE

with this.Treeview
	=.Nodes.Item(NodeName)
endwith

on error &sError

return NodeExists 
>Gregory,
>
>this is from my far remembrance. ::)
>
>The days I've started treeview was the days I've started VFP, so it's all old and forgotten.
>But I can remember problems with non closing forms (or environments what is mostly the sign of a form not closed to dead). The form was gone, all 'known' references where gone, but the DS was still there.
>
>In these days I've have done a lot with the child and sibbling properties of nodes. (I.e. iterating through the nodes and the like). The problem was bound to those calls. I traced it down to see that the problem occurs after those calls. Now I use I mirroed structure for the nodes to get the information I need and the problem is gone.
>
>I know this all is not very sophisticated, but again, this is from the times I know not much about VFP - and it's very old. I hope it will give you an idea to search.
>
>I use treeviews a lot and can tell you that treview or treelist will not create a dataenvironment.
>
>What you can do is to test if the DS left is the same as the DS of your form.
>Try to run
?SET("Datasession")
in your form and in the unknown DS.
>If the number is the same, then the form is not closed.
>
>If not...
>
>Try to trace where the DS is created. I guess ASESSIONS() is not available in VFP6SP5, so you need to check the datasession window.
>
>HTH
>
>Agnes
>>Hi all,
>>
>>I've got a Form with a (subclassed) container ( Treeview control and ImageList control ).
>>The Form has a private datasession. Closing the form leaves an unknown datasession behind. The form closes normally.
>>
>>Except for
this.Treeview.ImageList = this.ImageList
in the init() of the container, there are no object references being kept.
>>
>>Any solution to get rid of the unknown datasession ? (vfp6sp5)
>>
>>Leaving the ImageList out does not help either
>>
>>Thanks,
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform