Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6645157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:15:07+00:00 2026-05-26T00:15:07+00:00

It’s about objective c and cocoa I’ve faced a problem and don’t know how

  • 0

It’s about objective c and cocoa

I’ve faced a problem and don’t know how to solve it. Hope I can find answer here and it will be helpful for some other programmers.

So, I have a simple window with 4 elements:

  1. NSTextField – first field to set value
  2. NSButton – to set value in first field
  3. NSTextField – second field to set value
  4. NSButton – to set value in second field

here is “controller 1” code:

#import "controller2.h"

@interface controller1 : NSControl{
IBOutlet NSTextField * text1;
}
-(IBAction)click:(id)sender;
@end

@implementation controller1
-(IBAction)click:(id)sender
{
[text1 setStringValue:@"text1 changed"];

// create controller 2 instance
controller2 * c2 = [[[controller2 alloc] init] autorelease];
// call first time using one way
[c2 click:self];

// call second time using another way
[self sendAction:@selector(click:) to:c2];
}
@end

and controller 2 code:

@interface controller2 : NSControl{
IBOutlet NSTextField * text2;
}
-(IBAction)click:(id)sender;

@end

@implementation controller2
-(IBAction)click:(id)sender
{
[text2 setStringValue:@"text 2 changed"];
NSLog(@"Test2");
}
@end

when I click on button1 I rase “click” in controller1 – everything is fine and work correct

when I click on button2 I rase “click” in controller2 – everything is fine and work correct

BUT if I want to click button1 and rase “click” in controller2 it doesn’t work (

Can anyone help with it? It seems to have a very simple resolution but i don’t know what i did wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:15:07+00:00Added an answer on May 26, 2026 at 12:15 am
    controller2 * c2 = [[[controller2 alloc] init] autorelease];
    

    You’re creating a completely new “controller2” (bad name for a class, by the way – always capitalize class names: “MyController”, etc.). You need an IBOutlet from your Controller1 to a Controller2. That way you can send messages to it by name.

    Remember: objects in a nib are “freeze-dried” instances of classes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.