Q on Accessing multi-dimension arrays.

Ali Lloyd ali.lloyd at livecode.com
Fri Apr 27 03:21:38 EDT 2018


Which reminds me - the tree view widget should probably use the list form
of a path directly instead of fettling with a path delimiter property

On Fri, Apr 27, 2018 at 12:26 AM Alex Tweedly via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Thanks Brian, Bernd, and everyone else.
>
> When I first saw it (in the form described in Brian's email), I thought
> - hmmm, not sure when anyone would use that.
>
> Then I saw an example using split (as described in Bernd's email), and
> thought - maybe I can use that some day. :-)
>
> Well - the day has come. I realized that the "Tree View" widget has a
> property (hilitedElement) which is the "path" through the array of the
> highlighted line - and is the ideal use case for this feature.
>
> And now that I've started using that, I can find *SO* many other uses
> for it.
>
> My "directory walker" produces an array indexed by folder, then filename
> - and the values are some useful info about the file; e.g.
> tArray[tFolder][tFilename] === the info I want to keep
>
> I can now put that into a tree view array just by doing
>
> *repeat* foreachkeyK intAflat*
>     replace*"/"with"/ "intemp*    -- trick names to keep folders before
> files
>     split*temp by"/"*
>     put*tAflat[K] intotA[temp]*
> end* *repeat*
>
> *set the arrayData of widget "Tree" to tA*
>
> *Thanks again*
>
> *Alex.
> *
>
>
> On 26/04/2018 23:55, Richard Gaskin via use-livecode wrote:
> > Dick Kriesel to the rescue again!  Thanks for that background.
> > Comforting to know it's not merely an anomaly, but a well-considered
> > design decision.
> >
> > It's such a cool thing to be able to do.  It will change many algos
> > here...
> >
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list