Hi all. Anyone working with tree views will immediately encounter an oddity, where the hilitedElement returns a comma delimited list of the array keys to the clicked item in the tree view. A comma delimited list of keys is almost completely useless if you want to get the value of the actual item clicked on! If the item is an array, it will return that of course.
So I wrote a little function for getting the "actual" value of the key in the array corresponding to the selected item. There may be another way to do this baked into the XML library, but I could not discern it. Bob S on hiliteChanged -- this goes into your tree widget script local tElement put the arrayData of me into aTreeData put the hilitedElement of the target into tElement put getArrayKeyValueFromKeyList(aTreeData, tElement) into tKeyValue -- now you have the value pass hiliteChanged end hiliteChanged function getArrayKeyValueFromKeyList aArray, pKeyList -- this can go anywhere in the message path repeat for each item tKey in pKeyList put "[" & quote & tKey & quote & "] " after tArrayKey end repeat put "aArray" && tArrayKey into tArrayElement return value(tArrayElement) end getArrayKeyValueFromKeyList _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode