Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!helios!cs.tamu.edu From: dcheslow@cs.tamu.edu (David A Cheslow) Newsgroups: comp.sys.next Subject: a useful piece of code Message-ID: <17735@helios.TAMU.EDU> Date: 24 Jun 91 16:27:15 GMT Sender: usenet@helios.TAMU.EDU Organization: Computer Science Department, Texas A&M University Lines: 19 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 ). 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] ;