0

I've got:

MyWindowController.h
MyWindowController.m
HistoryController.h
HistoryController.m

In MyWindowController.h, there is:

IBOutlet NSPanel* viewInvoice;

And later on:

- (IBAction)viewInvoice:(NSNumber *)invoiceNumber;

I would like to make use of this panel throughout my program. In my HistoryController.m, there is:

- (IBAction)viewSelectedInvoice:(id)sender{
  id viewInvoiceObject = [[MyWindowController alloc] init];
  [viewInvoiceObject viewInvoice:[NSNumber numberWithInt:1]];
  [viewInvoiceObject release];
}

Now I can successfully access that method (some NSLog calls verify this), but I'm not at all able to actually make the NSPanel appear. Here's some of the code from there:

- (IBAction)viewInvoice:(NSNumber *)invoiceNumber {
  [viewSelectedInvoicePanel makeKeyAndOrderFront:viewSelectedInvoicePanel];
}

I'm able to make the panel pop up if I link the button in my History view to the FirstResponder action "viewInvoice", however it seems like I won't be able to send through a parameter (namely the invoice number).

Sergio Moura
  • 4,888
  • 1
  • 21
  • 38
D'Arcy Rail-Ip
  • 11,505
  • 11
  • 42
  • 67

1 Answers1

0

Edit your HistoryController to have your custom NSPanel as a Property:

@property (nonatomic, retain) IBOutlet NSPanel *viewInvoice;

Then, create an IBAction on your HistoryController to call your custom NSPanel function:

-(IBAction)viewInvoice:(id)sender {
  [self.viewInvoice viewInvoice:self.some_property_with_invoice_number];
}

And link your button to the viewInvoice method (inside the HistoryController class. Also, you should change the property object type from NSPanel to whatever you named your class.

Sergio Moura
  • 4,888
  • 1
  • 21
  • 38