re-Ordering sub stacks

Thomas McGrath III mcgrath3 at mac.com
Wed Nov 19 12:06:26 EST 2008


Chris,

As far as your actual problem maybe it is better to set the substacks  
mainstack property as in:
on orderSubs thismainStack
    get the substacks of stack thismainStack
    sort it
    put it into theSubstacks
    repeat with x = 1 to the number of lines of theSubstacks
       put line x of theSubstacks into theStack
       set the mainstack of stack theStack to thismainStack
    end repeat
    --set the substacks of stack thismainStack to it
    save stack thismainStack
end orderSubs

This works for me here with your stack.

P.S. Although this may not relate to your problem I wanted to comment:  
Your repeat loop will only find the first stack (if any) that starts  
with "ddm-" so maybe the repeat is not the best way to go.

Tom McGrath III
Lazy River Software
3mcgrath at comcast.net

iTunes Library Suite - libITS
Information and download can be found on this page:
http://www.lazyriversoftware.com/RevOne.html


On Nov 19, 2008, at 11:36 AM, Chris Condit wrote:
> button script:
>
> --re-order substacks
> on mouseUp
>  set the hilite of me to true
>  put mainstacks() into listOfMainStacks
>  put the num of lines in listOfMainStacks into numToDo
>  repeat with x = 1 to numToDo
>    if char 1 to 4 of line x of listOfMainStacks = "ddm-" then
>      put line x of listOfMainStacks into thismainStack
>      exit repeat
>    end if
>  end repeat
>  set the cursor to busy
>  lock Screen
>  orderSubs thismainStack
>    set the hilite of me to false
>  beep
>  answer "Done!"
>  set the cursor to arrow
>  set the hilite of me to false
> end mouseUp
>
> on orderSubs thismainStack
> 	get the substacks of stack thismainStack
> 	sort it
> 	set the substacks of stack thismainStack to it
> 	save stack thismainStack
> end orderSubs
>
> -









More information about the use-livecode mailing list