• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSMatrix Question...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMatrix Question...


  • Subject: Re: NSMatrix Question...
  • From: Jerry LeVan <email@hidden>
  • Date: Wed, 30 Jun 2004 17:09:32 -0400

I am ;(

Here is the routine that gets called when a cell in the matrix is clicked on...
***********
-(IBAction)showMe:(id)sender
{
// NSLog(@"ShowMe call with %@",sender);
int i= [thumbArray selectedRow];
[ [thumbArray cellAtRow:i column:0] setHighlighted:YES];
slideNumber = i; //
if(displayedImage) [displayedImage release]; // get rid of old image
displayedImage = [[NSImage alloc]initWithContentsOfFile:(NSString*)[fileNameList objectAtIndex:i]];
[self createScaledImage:displayedImage];
[self setBrowserTitle];
}
***********
The clicked cell is highlighted and then unhighlighted...In the subclassed I have a routine

-(void)drawInteriorWithFrame:(NSRect)frame inView:(NSView *)controlView
{
NSEvent * event = [NSApp currentEvent];
if ([self isHighlighted] || ([event type ] == NSLeftMouseUp)) {
[[NSColor selectedControlColor] set];
NSRectFill (frame);
}

[super drawInteriorWithFrame:frame inView:controlView];
}
*****************
This provides a nice blueish background when click and after I added the
event code, the cell background *keeps* the blue color, unfortunately the
background is fragile and sometimes disappears when the drawer containing the
the matrix is toggled into and out again.

Most of the time the blue vanishes when scrolled off screen....

Jerry

On Jun 30, 2004, at 4:34 PM, Mark A. Stratman wrote:

This may not help, but have you tried NSMatrix's highlightCell:atRow:column: rather than calling the individual cell's setHighlighted: ?
My guess is that the matrix is keeping its own record of which cells are highlighted. By directly manipulating the cell you're "going over its head" so it doesn't know that the cell should be highlighted, and it reverts the cell back to the state it thinks it should be in.

If that's not any help and nobody else responds on here, try running it in the debugger and pinpointing as best you can where it's being un-highlighted.

- mark

On Jun 29, 2004, at 10:34 PM, Jerry LeVan wrote:

Hi,

I have an NSMatrix of subclassed NSImageCells. The matrix is
setup in radiobutton mode so my action will be called when
a cell is clicked.

I want to keep track of which cell is the selected cell by
highlighting the cell. ( I use setHighlighted:YES)

If I select cells under program control, the cells highlight
nicely.

If I select a cell by clicking on the rascal, the cell highlights
and then @#!& unhighlights. ( my action routine does a setHighlighted:YES)
so it might be the case that the NSMatrix code messes with the
highlighting after the action routine returns....

Is there any way I can keep the selected cell highlighted when
clicking on the rascal?

Jerry
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: NSMatrix Question...
      • From: Stephen Norum <email@hidden>
References: 
 >NSMatrix Question... (From: Jerry LeVan <email@hidden>)
 >Re: NSMatrix Question... (From: "Mark A. Stratman" <email@hidden>)

  • Prev by Date: Re: NSMatrix Question...
  • Next by Date: Re: NSMatrix Question...
  • Previous by thread: Re: NSMatrix Question...
  • Next by thread: Re: NSMatrix Question...
  • Index(es):
    • Date
    • Thread