Note that there are some explanatory texts on larger screens.

plurals
  1. PONSWindow created in IB won't show modally in the application
    primarykey
    data
    text
    <p>I have an application that when pressing a button it should show a modal window. I have some questions about it but I'm going to narrow it to what it's giving me a headache. </p> <p>I want to add that I'm already doing something alike that when applied to this particularly case won't work. What I already do is to show modally a NSOpenPanel. This is the code for it. </p> <p>This code is inside the appDelegate. </p> <pre><code>-(IBAction) respondToPublishAction:(id) sender { NSArray *fileTypes = [NSArray arrayWithObjects:@"xml", @"txt", nil]; NSOpenPanel *oPanel = [NSOpenPanel openPanel]; NSString *startingDir = [[NSUserDefaults standardUserDefaults] objectForKey:@"StartingDirectory"]; if (!startingDir) startingDir = NSHomeDirectory(); //Setting the attributes [oPanel setAllowsMultipleSelection:NO]; [oPanel setTitle:@"XML file for publishing services"]; [oPanel beginSheetForDirectory:startingDir file:nil types:fileTypes modalForWindow:[self window] modalDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:nil]; } </code></pre> <p>Now What I'm trying to do and that won't work</p> <p>I created a xib file that has a HUD Window (how it's named in IB) that acts like a NSPanel. I created a windowcotroller that listen to a button (testButton). Here's the code:</p> <pre><code>@interface BrowserWindowController : NSWindowController { } -(IBAction) testButton:(id) sender; @end </code></pre> <p>I set the file's owner of the xib file to be of the class BrowserWindowController and linked the button with the testbutton.</p> <p>Back to the appDelegate when a button is clicked I want to show this Panel modally. Here's the code:</p> <pre><code>- (IBAction) respondToBrowseAction:(id) sender { browsePanel = [[BrowserWindowController alloc] initWithWindowNibName:@"BroserWindow"]; } </code></pre> <p>I don't see any function in the API like NSOpenPanel to show this window modally. </p> <p>Thx to anyone who might answer.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload