Setting and Retrieving Custom Properties within rTree

This is a forum focused on providing support for rTree

Moderators: heatherlaine, robinmiller, kevinmiller, wilstrand

Post Reply
Mike Doub
Posts: 2
Joined: Mon Aug 26, 2013 6:49 pm

Setting and Retrieving Custom Properties within rTree

Post by Mike Doub » Sat Mar 22, 2014 10:30 pm

I am creating an rTree from an array. This array includes some custom properties. When I look at the nodeData after creating the rTree, I do in fact see the custom properties, however I am not able to retrieve them using the custom syntax:

put the accountID_of_node_ID_[email_id] of control "inbox"

Interestingly enough when I use this syntax to set the variable I am able to retrieve it:

set the accountID_of_node_ID_[email_id] of control "inbox" to 99
put the accountID_of_node_ID_[email_id] of control "inbox"

Can you explain how these user created properties work or point me to an area within the rTree code? I am unable to find the code that would be relevant. There is a lot of code here :-). Why would I not be able to retrieve a custom property that was created in an array?

Regards,
Mike

wilstrand
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 114
Joined: Mon Jan 03, 2011 3:02 pm
Contact:

Re: Setting and Retrieving Custom Properties within rTree

Post by wilstrand » Mon Mar 24, 2014 2:52 pm

Hi Mike!

What you are doing when you set a custom property with your:

Code: Select all

the accountID_of_node_ID_[email_id] of control "inbox" to 99
is that you actually creates a customPropertySet with the name:
"accountID_of_node_ID_"
You should see it in your Property Inspector.

You can of course then get the value of your custom property with:

Code: Select all

put the accountID_of_node_ID_[email_id] of control "inbox"
But note that this custom property will not get into the Tree array!

If you on the other hand put your custom property data into the Tree array in the first place
there are two ways you can retrieve that data:
Either get the array from the Tree into a variable and work with that:

Code: Select all

put the nodeData of control "inbox" into tNodeDataA
return tNodeDataA[email_id][accountID]
or use a getProp handler in your control script to work with the customPropertySet syntax:

Code: Select all

getProp accountID_of_node_ID_[tID]
   put the nodeData of control "inbox" into tNodeDataA
   return tNodeDataA[tID]["accountID"]
end accountID_of_node_ID_
Hope this explains it!

Best regards
Mats
http:www.tapirsoft.on-rev.com
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects

Post Reply

Return to “rTree”