Tree Widget: hilitedValue?

Brian Milby brian at
Sat Jul 9 20:11:29 EDT 2022

I don't think there is an existing one liner, but it can be done a couple

Here is a recursive function defined in the PI code for Custom Props:

on fetchArrayDataOnPath pPath, pArray, @rData
   local tKey
   put item 1 of pPath into tKey
   if the number of items in pPath is 1 then
      if tKey is not among the keys of pArray then
         return "no such key"
         put pArray[tKey] into rData
         return empty
      end if
      delete item 1 of pPath
      fetchArrayDataOnPath pPath, pArray[tKey], rData
   end if
end fetchArrayDataOnPath

There are other handlers in that script that could be useful as well

You could also turn the path into an array (but lose the error checking

function getValue pArray, pPath
   split pPath by comma
   return pArray[pPath]
end getValue


On Sat, Jul 9, 2022 at 5:08 PM J. Landman Gay via use-livecode <
use-livecode at> wrote:

> On 7/9/22 3:17 PM, J. Landman Gay via use-livecode wrote:
> > On 7/8/22 12:34 PM, Richard Gaskin via use-livecode wrote:
> >> I see the Tree widget supports a hilitedElement property, which is
> useful for managing the
> >> selection in the UI.
> >>
> >> Is there a one-liner for obtaining not the element path but the value?
> >
> > I'm using an older version, but here the hilitedElement includes the
> values of each element in
> > the path.
> >
> I misunderstood, you don't mean just the names of the elements. The value
> shows up as part of
> the tree unless you turn off "show values". I think you'll have to parse
> the array to actually
> get the values in a leaf.
> --
> Jacqueline Landman Gay         |     jacque at
> HyperActive Software           |
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:

More information about the use-livecode mailing list