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 6803897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:24:01+00:00 2026-05-26T19:24:01+00:00

I have two short questions: How is it possible to reopen a window after

  • 0

I have two short questions:

  1. How is it possible to reopen a window after closing it.
  2. How do I set the focus on the window I open.

It would be nice if someone can help me!

Here is the source code I have so far but I don’t know how to go on:

The method calling the WindowController:

- (IBAction)openPreferences:(id)sender 
{
[NSApp activateIgnoringOtherApps:YES];

if (NULL == preferences) 
{
    preferences = [[PreferencesController alloc] initWithWindowNibName:@"Preferences"];
}
[preferences showPreferenceWindow];
}

This is the Header of PreferencesController:

#import <Foundation/Foundation.h>

@interface PreferencesController : NSWindowController <NSWindowDelegate>
- (void)showPreferenceWindow;
@end

This is the Main of PreferencesController:

 #import "PreferencesController"

 @interface PreferencesController()
 @end

 @implementation PreferencesController

 - (void)windowWillClose:(NSNotification *)notification
 {

 }

 // display the preference window
 - (void)showPreferenceWindow
 {
     [self.window makeKeyAndOrderFront:NSApp];

     // TODO: window should be focused and if the user press the close button it should be displayed again
 }

 - (void) dealloc
 {
    [super dealloc];
 }

 @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-05-26T19:24:02+00:00Added an answer on May 26, 2026 at 7:24 pm

    NSWindow has this handy method - (void)setReleasedWhenClosed:(BOOL)releasedWhenClosed. Set that to NO and you window can open unlimited amounts of times. As to your focus issue: It should already be working to bringing your window to focus.

    But since you are using a preference window: may I suggest DBPrefsWindowController it is pretty old but it still works today.

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

Sidebar

Related Questions

I have two variables: unsigned short a,b; /* When I compare them with a
In short: I have two matrices (or arrays): import numpy block_1 = numpy.matrix([[ 0,
In short: I want to have two fullscreen views, where I can switch between
I will be short, what i have is array=( one.a two.b tree.c four.b five_b_abc)
Is it possible to set the maximum number of open files to some infinite
I have two questions. Both involve CodeIgniter's session support when using the database as
I've two questions: I would like to know what sort of variable types can
Just a short question... I have a span container which is correctly set in
I have an example class containing two data points: public enum Sort { First,
Have two folders with approx. 150 java property files. In a shell script, how

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.