TreeView custom sort?
blueback09 at gmail.com
Sat Dec 10 21:03:21 CET 2016
Do you need the user to be able to interact with each named object
individually through the TreeView widget? If not, maybe you can just
replace the single object name with a list of all relevant objects in your
preferred sort order. You'd still get a hierarchy of groups that way. You
could just "open" the list in a list field to address an individual object.
On Sat, Dec 10, 2016 at 10:33 AM, Richard Gaskin <ambassador at fourthworld.com
> Tore Nilsen wrote:
> > Could you build the initial array with the object names as keys, add
> > the layer numbers as part of the information you store about each
> > element, then sort the array by layer numbers and set the array of
> > the tree view widget to the sorted array?
> Ah, but arrays aren't sortable per se.
> We can sort the keys of an array, but what we're doing there is sorting a
> delimited chunk.
> Associative arrays have no internal representation of order, so no matter
> what I do with the keys the array itself will remain a hash table of
> unpredictable order.
> I could prepend the top-level array key with a number, but this has two
> 1. Not being purely numeric, it can only sort alphabetically, producing
> things like this:
> 1 First item
> 11 Eleventh item
> 2 Second item
> 2. I'd prefer not to have the numbers visible to the user at all, since
> they would be just an artifice used for sorting and have no semantic
> meaning in my UI.
> If the TreeView offered options for using custom sort functions that might
> work well, esp. if I could alter keys as it goes so I could remove the
> numeric portion. But at the moment I don't believe it does.
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> Ambassador at FourthWorld.com http://www.FourthWorld.com
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
More information about the use-livecode