• 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: Cocoa Programming Ch. 5 Challenge
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa Programming Ch. 5 Challenge


  • Subject: Re: Cocoa Programming Ch. 5 Challenge
  • From: Jens Bauer <email@hidden>
  • Date: Thu, 3 Jan 2002 16:48:35 +0100

Hi Mike,

On Wed, 2 Jan, 2002, Mike Brinkman <email@hidden> wrote:

>Here's my code:
>
>- (void)tableViewSelectionDidChange:(NSNotification *)n
>{
> int row = [tableView selectedRow];
> [deleteButton setEnabled:(([employees count] > 1) && (row != -1))];
>}

Try this instead:
[deleteButton setEnabled:(([employees count] > 0) && (row != -1))];

If we have more than 0, we have at least 1. Earlier you were demanding at
least 2 to delete one.

-As I've not read the book yet, and I don't have the entire code, I
cannot tell you if this is exactly what is wrong. You may want to change
the line into...
[deleteButon setEnabled:row != -1];
..to test if it works at all.

I guess that the row variable is -1 if nothing is selected, otherwise
it's the item number
of the selected cell, right ?

Note: You don't need any parantheses at all in the above mentioned line.


Love,
Jens


References: 
 >Cocoa Programming Ch. 5 Challenge (From: Mike Brinkman <email@hidden>)

  • Prev by Date: Re: Screen Fade Out
  • Next by Date: Re: Apple's excellent documentation on class clusters
  • Previous by thread: Cocoa Programming Ch. 5 Challenge
  • Next by thread: Re: services
  • Index(es):
    • Date
    • Thread