Document.xib contains two windows, one window needs to be a preference panel
Asked Answered
D

1

0

I have created a Document-Based Application using Core Data. I replaced the automatically created window in Document.xib with two windows: a "Panel" window and a "Window" window.

The "Panel" window contains a table view with bindings to an NSArrayController. The table view is used to add data to the array using the document class's entities and attributes. I would like to make this window act as a Preferences window. This window should appear when a button in the main "Window" is clicked.

The "Window" is my main window where I display data from the same NSArrayController using bindings. This window contains a button that I would like to use to make the "Panel" window appear.

I can hide the "Panel" window upon launch and only show the main "Window", but I can't figure out how to set the action of the button to show the "Panel" window.

Any thoughts on how to accomplish this??

I tried using two separate XIB files, but then I have a problem where I can't get the NSArrayController data into the other window.

Dissonant answered 20/2, 2012 at 6:6 Comment(0)
M
1

Try connecting your button's action selector to your panel's makeKeyAndOrderFront: action.

Moulmein answered 22/2, 2012 at 17:55 Comment(1)
Ok, I got it working using this -(IBAction)openLocationWindow(id)sender{ [locationWindow makeKeyAndOrderFront:sender]; } for the action of the button. I used an IBOutlet NSWindow *locationWindow; to identify the window.Dissonant

© 2022 - 2024 — McMap. All rights reserved.