dcheslow@cs.tamu.edu (David A Cheslow) (06/24/91)
Here is a snipet of OC code that ask_next@next.com sent to me. its purpose is to select a number of cells in a matrix from within code (much like you could do with the mouse using <shift><click>). this particlular piece of code selects even numbered rows and deselects odd numbered rows, but should be eisily modified for other patterns or conditions
int rows;
[matrix getNumRows:&rows numCols:NULL] ;
[matrix lockFocus] ;
while (rows--)
{
NXRect rect;
BOOL even =( rows % 2) == 0;
id cell = [matrix cellAt:rows:0] ;
[matrix getCellFrame:&rect at:rows :0] ;
[cell setState:(even ? 1 : 0)] ;
[cell highlight:&rect inView:matrix lit:even] ;
}
[matrix unlockFocus] ;
[[matrix window] flushWindow] ;