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

Help with Variable Scope


  • Subject: Help with Variable Scope
  • From: Graham Wihlidal <email@hidden>
  • Date: Sat, 17 Nov 2001 03:52:28 -0700

Hey list

I can't get this to work and I don't know why?

I have an NSWindowController class and in the header I put:

IBOutlet NSButton *ConnectBtn;

In the Nib, the window the controller represents has a button which I created an outlet in the class for the button. (called ConnectBtn).

I set things up and connect the outlet and it compiles fine, but the class doesn't seem to know WHERE this variable is? I am trying to call this from another class:

mSessionWin = [[SessionWin alloc] init];
[[mSessionWin window] center];
[[mSessionWin window] makeKeyAndOrderFront:[mSessionWin window]];
[[mSessionWin ConnectBtn] setEnabled:FALSE];

To test if it works I just put a setEnabled function on the button and the button never disables, and the log spits out:

2001-11-17 03:45:54.323 Untitled[1595] *** -[SessionWin ConnectBtn]: selector not recognized
2001-11-17 03:45:54.324 Untitled[1595] Exception raised during posting of notification. Ignored. exception: *** -[SessionWin ConnectBtn]: selector not recognized

The window displays fine and technically the button should be 'known'

I can access that variable the way it is set up INSIDE the window controller class and it works perfectly. What am I doing wrong? Is this just a scope problem and I have to make wrapper functions like "ChangeStateOfConnectBtn" and access it locally?

Thanks in advance,

Graham


  • Follow-Ups:
    • Re: Help with Variable Scope
      • From: Ondra Cada <email@hidden>
  • Prev by Date: Re: NSUserDefaults key validation
  • Next by Date: Re: Standard OS X Compression format
  • Previous by thread: Re: &xxx; thingies
  • Next by thread: Re: Help with Variable Scope
  • Index(es):
    • Date
    • Thread