• 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
Strange problem showing a window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange problem showing a window


  • Subject: Strange problem showing a window
  • From: Angela Brett <email@hidden>
  • Date: Fri, 7 Feb 2003 23:03:21 +1300

Hi there,

I have a separate nib file for my app's About box, and some very simple code in an action method hooked up to the 'About' menu item to load the information into it:

- (IBAction)showAboutPanel:(id)sender {
if (!legendField) {
[NSBundle loadNibNamed:@"AboutBox" owner:self];
[legendField readRTFDFromFile:[[NSBundle mainBundle] pathForResource:@"legend" ofType:@"rtf"]];
[targetbirdsField readRTFDFromFile:[[NSBundle mainBundle] pathForResource:@"Credits" ofType:@"rtfd"]];
[versionHistoryField readRTFDFromFile:[[NSBundle mainBundle] pathForResource:@"Version History" ofType:@"rtf"]];
}
[[legendField window] makeKeyAndOrderFront:nil];
}

Now, when I first did this, it didn't work for two or three times - the code seemed to be executing but the window didn't appear. Then it started working about the third time I run the app, after not making any changes to the code.

Now I've made a change to the nib, to add the versionHistoryField, and the corresponding line to the code. I have the same problem as before... the code gets executed but the window doesn't appear.

Now what makes this *really* weird is what happens when I step through the code in the debugger. It goes to the third line (the [NSBundle loadNibNamed:.. line) then the fourth line, then back to the third line, then the fourth, then back to the third, and from then on it goes through the lines of code normally. Stranger still, while it's doing this, the values of sender and _cmd change, until eventually _cmd is 0x0 and sender is 0x1.

I know that sometimes the lines highlighted in the debugger are sometimes a line or two above or below the actual lines of code being executed, but there is no loop nearby, so I have no idea what could be causing this. What on Earth could be changing sender and _cmd in the middle of the function? Maybe that's just a strange quirk of the debugger, but still, I can't get the window to appear.

I have tried clean building the project, running it not in the debugger, restarting PB, re-saving the nib, but I'm out of ideas. I can't see anything that could be wrong with the code, and I know that last time this happened it eventually started working. I can't remember if I did anything different that time. Any ideas?
--
Angela Brett
email@hidden
http://acronyms.co.nz/angela
_______________________________________________
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: Strange problem showing a window
      • From: Greg Hulands <email@hidden>
  • Prev by Date: Re: Preferences, Authorization, Writing files
  • Next by Date: noCacheMask not working on iDisk?
  • Previous by thread: Re: Preferences, Authorization, Writing files
  • Next by thread: Re: Strange problem showing a window
  • Index(es):
    • Date
    • Thread