[comp.sys.next] Matrix NX_LISTMODE

ali@polya.Stanford.EDU (Ali T. Ozer) (04/18/89)

In article <1586@blake.acs.washington.edu> Mark Crispin writes:
>     Now, to put some signal into this noisy message: I am *still*
>trying to figure out how in an NX_LISTMODE matrix how to
>programmatically get the effect of COMMAND/LEFT-MOUSE on a matrix item
>(that is, *add* it to the selected items instead of making it the only
>selected item).  Merely calling highlightCellAt::lit: visually does
>the right thing, but leads to bizarre effects when you try selection
>modification via the mouse.

You will need to set the state of the cell you want to select to 1 before
you call highlightCellAt::lit:. Here's a code fragment that will do the trick:
(You can add this to a subclass of Matrix or, with the appropriate changes,
use it in other ways...)

- addToSelection:(int)row :(int)col
{
  // selectCellAt:: deselects all others; so we need
  // to select in addition, using:

  [[self cellAt:row:col] setState:1];
  [self lockFocus];
  [self highlightCellAt:row:col lit:YES];
  [self unlockFocus];

  return self;
}

Ali Ozer, NeXT Developer Support
aozer@NeXT.com