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

  • Home
  • SEARCH
  • 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 8590345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:16:25+00:00 2026-06-11T23:16:25+00:00

Is it possible to access parent object from its property? In this simple application

  • 0

Is it possible to access parent object from its property?

In this simple application I have a window which responds to keypress events.
I want my property object named “window” to set its parent object “AppDelegate” variable “upKeyPressed” to a value when event occurs.
Is it possible in any way?

AppDelegate.h:

@interface MyWindow : NSWindow
@end

@interface AppDelegate : NSObject <NSApplicationDelegate>
{
    BOOL upKeyPressed;
}
@property (assign) IBOutlet MyWindow *window;
@end

AppDelegate.m file:

@implementation MyWindow

- (void)moveUp:(id)sender
{
    // here I want to set upKeyPressed value to YES with a kind of:
    self.parentObject->upKeyPressed = YES; // *** fantasy command
}

@end

@implementation AppDelegate
...
@end
  • 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-06-11T23:16:27+00:00Added an answer on June 11, 2026 at 11:16 pm

    No, there is no concept of parents when it comes to properties. What you want to do is add @property (assign) AppDelegate *parentObject; (you can call it what you want) to your MyWindow class’s interface. Then synthesize it in your implementation.

    For it to work, you also need to set it to point to your app delegate – in your -applicationDidFinishLaunchingWithOptions: add self.window.parentObject = self;. Then to access the so-called “parent” object from your MyWindow instance, just use self.parentObject.

    Edit: You need to forward-declare AppDelegate by putting @class AppDelegate; before your interface definition for MyWindow.

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

Sidebar

Related Questions

Possible Duplicate: how to access parent window object using jquery? I have the following
Is it possible to access a child property from a parent class, when both
Is it possible to access a parent class from within an attribute. For example
Is it possible to access a parent member in a child class... class MainClass
Is it possible to access the Data Purge Tool from the Valence API?
Let's say I have a class which has a property hiding it's base property
How would I access a Parent Container to change its css in an Html
Possible Duplicate: Access array returned by a function in php I have a function
In python it's possible to use '.' in order to access object's dictionary items.
I have an ATL COM object which needs to expose a collection of other

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.