Re: Tree Widget: hilitedValue?

2022-07-11 Thread Mark Waddingham via use-livecode
On 2022-07-10 21:33, Richard Gaskin via use-livecode wrote: Brian Milby wrote: You could also turn the path into an array (but lose the error checking above): function getValue pArray, pPath split pPath by comma return pArray[pPath] end getValue Thanks, Brian. I keep forgetting we can

Re: Tree Widget: hilitedValue?

2022-07-10 Thread Brian Milby via use-livecode
If pPath[1] = “a” and pPath[2] = “b” Then pArray[pPath] is the same as saying pArray[“a”][“b”] I’m not sure when it was added. It is relatively recent (7 or 8 I think, but not sure) Thanks, Brian Sent from my iPhone > On Jul 10, 2022, at 4:46 PM, J. Landman Gay via use-livecode > wrote: >

Re: Tree Widget: hilitedValue?

2022-07-10 Thread J. Landman Gay via use-livecode
On 7/9/22 7:11 PM, Brian Milby via use-livecode wrote: function getValue pArray, pPath split pPath by comma return pArray[pPath] end getValue I keep forgetting we can do that. It's cool, but I don't understand how it works. Splitting the path by comma produces a numbered array, and

Re: Tree Widget: hilitedValue?

2022-07-10 Thread Richard Gaskin via use-livecode
Brian Milby wrote: > You could also turn the path into an array (but lose the error > checking above): > > function getValue pArray, pPath > split pPath by comma > return pArray[pPath] > end getValue Thanks, Brian. I keep forgetting we can use an array as an element specifier. Has that

Re: Tree Widget: hilitedValue?

2022-07-09 Thread Brian Milby via use-livecode
I don't think there is an existing one liner, but it can be done a couple ways. 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

Re: Tree Widget: hilitedValue?

2022-07-09 Thread J. Landman Gay via use-livecode
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

Re: Tree Widget: hilitedValue?

2022-07-09 Thread J. Landman Gay via use-livecode
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

Tree Widget: hilitedValue?

2022-07-08 Thread Richard Gaskin via use-livecode
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? It wouldn't kill me to extract the arrayData and turn a hilitedElement path like: level1,level2,level3,