Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Dec 13, 2019 10:14 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: einhugur Treeview
PostPosted: Thu Jun 03, 2010 10:36 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
Use the Property Node.HasExpander to see if the node being double-clicked is expandable. If not, ignore the double click, or, as you'll see below, if it's not expandable, get the folderitem (or other data) from the node.ItemData and do something with it.

In the node.BeforeNodeExpanding event check the Node.NodeCount property to see if you have already added the children nodes. If not, you'll do something like this:

Pseudo code:
dim oChildNode as TreeViewNode
oChildNode = New TreeViewNode("First Child Node")
oChildNode.ItemData = fFirstChildFolderitem
Node.appendNode oChildNode

oChildNode = New TreeViewNode("Second Child Node")
oChildNode.ItemData = fSecondChildFolderitem
Node.appendNode oChildNode

oChildNode = New TreeViewNode("Third Child Node")
oChildNode.ItemData = fThirdChildFolderitem
Node.appendNode oChildNode

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
Reply with quote  
 Post subject: Re: einhugur Treeview
PostPosted: Thu Jun 03, 2010 12:48 pm 
Offline

Joined: Mon Apr 19, 2010 12:58 pm
Posts: 92
Hi Bob,

Thankyou for your help, this code in the doubleclick event does exactly what I require,
the parent expands if children are present and the else clause picks up the data.

dim fileName as string

if node.HasExpander = true then

node.SetExpanded(not node.Expanded,true)
else
fileName=node.ItemData // we have a child

end if


Regards

John


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group