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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:15:33+00:00 2026-05-13T22:15:33+00:00

I am developing an plugin for OsiriX . In that app i have 3-4

  • 0

I am developing an plugin for OsiriX.

In that app i have 3-4 nib files. Also in for plugin there are files (.h & .m) called PluginFilter where method called – (long) filterImage:(NSString) menuName is present from which the plugin start execution. Now my problem is that, I have return the code to launch main window is in some other .m file and I have to call that file using the method mentioned above.

The app has multiple nib files. I have a plugin name PluginFilter called by:

- (long) filterImage:(NSString*) menuName

The plugin should open a window when called by this method. The code that defines the window controller is in another nib. When I call the filterimage method in the plugin, the window never appears.

Here is my filterImage: method.

#import "XGridInOsiriXFilter.h"
#import "MainWindowController.h"

@implementation XGridInOsiriXFilter

- (void) initPlugin
{

}

- (long) filterImage:(NSString*) menuName
{

    MainWindowController *mainWindowController = [[GridSampleMainWindowController alloc] init];
    [mainWindowController showWindow:self ];
    [mainWindowController release];

    return 0;
}

@end

Calling the method produces not warnings or errors, the window simply fails to appear.

  • 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-13T22:15:33+00:00Added an answer on May 13, 2026 at 10:15 pm

    You would normally not open the app’s main window from a plugin. Plugins by definition my not always be present so you should not put critical code in them. Neither would you want multiple plugins opening the same logical window.

    Instead, the main window should be displayed by the app delegate as normal but the content of the window can be processed by a plugin if the plugin is available.

    The main application should load and configure the main window and only call the plugin to process the contents of the window.

    Even so it is technically possible to open a window from a plugin so either (1) the plugin is not being loaded and the method is not being called (insert breakpoint/log to confirm) or (2) the window controller is misconfigured so that it does not open the window. Test the controller outside the plugin to confirm it works. Better yet, move the window opening code outside the plugin.

    Edit01:

    From comment:

    I have made some changes in the above
    code as follows

    - (long) filterImage:(NSString*) menuName { 
        MainWindowController *mainWindowController = [[GridSampleMainWindowController alloc] init:self];            
        [mainWindowController showWindow:self ]; 
        [mainWindowController release]; 
        return 0; 
    }
    

    but it is showing wanring that no
    -init method found. Why it is showing like this because -init method is der
    in the MainWindowController.m file

    Well, you have two problems here.

    (1) You set define mainWindowController as of class MainWindowController but you initialize it with class GridSampleMainWindowController. If MainWindowController is a subclass of GridSampleMainWindowController this will work but will generate warnings. You should instead initialize it like

    GridSampleMainWindowController *mainWindowController = [[GridSampleMainWindowController alloc] init:self];  
    

    or

    MainWindowController *mainWindowController = [[MainWindowController alloc] init:self]; 
    

    (2) You release the controller without any other object retaining it which will kill it. When a window controller dies it deallocates the windows it controls. This is most likely why you see nothing.

    You should sort out what class you want the controller to be and then set it as a retained property of the plugin class so you can keep it an its window around.

    Which init method is it complaining about? Your initPlugin does nothing and returns a void if that is the plugin’s actual initialization method then the plugin will never load. It should at least look like this:

    - (id) initPlugin
    {
        self=[super init];
        return self;
    }
    

    It looks like you come from a pure C background which is great for this environment but you need to learn about the object oriented parts of the Objective-C language. You’re still writing methods as if they were old school C functions and there are important and oft times subtle differences.

    Sorry I missed all this yesterday. I saw “plugin” and focused on the wrong aspect of the problem.

    Edit02:

    No i m not talking about my initPlugin
    method. I am talking about my init
    method which is there in
    MainWindowController.m file

    - (id)init { 
          self = [super initWithWindowNibName:@"MainWindow"]; 
          return self; 
    }
    

    This will return an instance of the MainWindowController‘s super class. If you’re not doing any customization you have no need to override the init method in you subclass. Just use the inherited version thusly:

    MainWindowController *mainWindowController = [[MainWindowController alloc] initWithWindowNibName:@"MainWindow"]; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.