• 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: Out-of-bounds error when removing entry from NSForm
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Out-of-bounds error when removing entry from NSForm


  • Subject: Re: Out-of-bounds error when removing entry from NSForm
  • From: email@hidden
  • Date: Tue, 15 May 2007 13:42:58 -0400

Another suggestion is to try the method:

	- (void)renewRows:(int)newRows columns:(int)newCols

which NSForm inherits from NSMatrix. This method resizes a matrix in one shot, but NSForm may be different enough to not implement it (like how NSOutlineView doesn't implement everything from NSTableView).

----
Aaron Burghardt
email@hidden


On May 15, 2007, at 10:57 AM, Sam Stigler wrote:

Thanks George! Your while loop worked; and something in your first sentence made me think that maybe my problem was that my "for" loop was counting the wrong way. I reversed it (see code below), and now it works. So for anybody reading this in the archive who is having a similar problem with NSForm, try reversing your "for" loop and see if that does the trick. I guess that's make sense, because in a form entries, indexed 0 to 3 for example, it makes sense that the form would remove index 3 before it removed index 0. Next time I should really draw it out or something...

int numrows = [metadataForm numberOfRows];
int curRow = numrows-1;
for (curRow; curRow >= 0; curRow--) {
		[metadataForm removeEntryAtIndex:curRow];
}


-Sam http://www.stigler.org/sam/wordpress


On May 16, 2007, at 12:14 AM, George Orthwein wrote:

Just a guess... could it be that in your loop, as you remove rows, the total row count reduces each loop so that curRow eventually becomes out of bounds? You can remove the highest index first and count down or perhaps a while loop like this would work:

while ([metadataForm numberOfRows])
{
   [metadataForm removeEntryAtIndex:0];
}




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Out-of-bounds error when removing entry from NSForm (From: Sam Stigler <email@hidden>)
 >Re: Out-of-bounds error when removing entry from NSForm (From: George Orthwein <email@hidden>)
 >Re: Out-of-bounds error when removing entry from NSForm (From: Sam Stigler <email@hidden>)

  • Prev by Date: Re: NSDictionary valueForKey: and @ character at start of NSString
  • Next by Date: RE: US/non-US localization problem
  • Previous by thread: Re: Out-of-bounds error when removing entry from NSForm
  • Next by thread: paths for contents of a directory
  • Index(es):
    • Date
    • Thread