• 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 with NSTextFieldCells
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMatrix with NSTextFieldCells


  • Subject: Re: NSMatrix with NSTextFieldCells
  • From: Philip Taff <email@hidden>
  • Date: Wed, 24 May 2006 23:10:51 -0500

I have the highlighting code in the an action named selectCell:, which is part of the custom NSMatrix subclass I am now using. If I set the matrix's doubleAction to selectCell:, and the target to self, then a double-click on a cell properly highlights the clicked button cell (I have switched to using button cells now, thanks).

But I tried wiring the button cells to the selectCell: action in their parent matrix, via Interface Builder, and by setting a breakpoint inside the selectCell: method, I can verify that whether I single-click (triggering the cell's action) or double-click (triggering the cell's action and then the matrix's doubleAction), selectCell: runs (twice for a double-click), but only for a double- click does the cell get highlighted.

Anyone have any idea why the doubleAction works but the cell actions don't? Here's the selectCell: method(selectedRow and selectedColumn are ints) from my custom subclass of NSMatrix. The breakpoint was at the end of the method.

- (IBAction)selectCell:(id)sender
{
	[self highlightCell:NO atRow:selectedRow column:selectedColumn];

	id selection = [self selectedCell];
	if (selection == nil) {
		NSBeep();
		return;
	}

	[self getRow:&selectedRow column:&selectedColumn ofCell:selection];
	[self highlightCell:YES atRow:selectedRow column:selectedColumn];
}

Thanks for your help!
--Philip



Have you considered replacing your text fields with button cells? That seems to be the behavior you're looking for. You can use - [NSCell setTitle:] to set the strings appearing in each cell.

	-- F


--
Fritz Anderson -- http://www.manoverboard.org/
Consulting Programmer -- http://resume.manoverboard.org/
Step into Xcode, Engrossing Beach Reading! -- http:// six.manoverboard.org/





_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >NSMatrix with NSTextFieldCells (From: Philip Taff <email@hidden>)
 >Re: NSMatrix with NSTextFieldCells (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: NSData, chars, and torrent files
  • Next by Date: Selected Entity
  • Previous by thread: Re: NSMatrix with NSTextFieldCells
  • Next by thread: What encoding to use to turn NSData from a subprocess into an NSString?
  • Index(es):
    • Date
    • Thread