setSelection help

Hello,

what is the trick for selecting all objects within a module???

-Jim
 

Object firsto = first(current Module)
Object lasto = last(current Module)
 
setSelection(firsto,lasto)

SystemAdmin - Mon Aug 27 16:24:15 EDT 2012

Re: setSelection help
SystemAdmin - Mon Aug 27 18:24:19 EDT 2012

When using the setSelection(Object start, Object finish) function, the "start" and "finish" objects must be siblings, any children under these will be included in the selection.

So assuming that the very first object in the module is a level 1 object, that will represent the start of the selection, we just need to find which object is the last level 1 sibling which will represent the finish of the selection. Try the following.
 

Object oFirst, oFinish, o
Module m = current
 
oFirst = first(m)  //Assumes that the first object in m is a level 1 object
current = oFirst   //Make oFirst this the current object
o = current        //Set o to be current in prep for the While loop
 
while (!null next sibling o ){//Trying to find the last level 1 sibling to oFirst
    o = next sibling o    //if next sibling o = null, then o in this loop is currently pointing to the last level 1 sibling
        }
 
oFinish = o
 
setSelection(oFirst, oFinish)

 


Paul Miller,
Melbourne, Australia