Walking Trees Backwards

Bernard Devlin bdrunrev at gmail.com
Thu Sep 11 15:18:38 EDT 2008


I'm not sure if I've understood the problem properly, but given a delimited
list where the number of delimiters = depth then a custom sort will provide
you with the lines by depth:

on mouseUp
  put fld "outline" into tx  -- each line has 0 or more tabs to indicate
outline depth
  sort tx descending by customSort(each)
  put tx
end mouseUp

function customSort pLine
  set the itemDel to tab
  return the number of items in pLine
end customSort

Assuming at least 1 line has 1 tab, then that line will be at the top of the
list. Does this help you to find the starting point for the backwards
search?

Bernard



More information about the use-livecode mailing list