I have 2 .xib windows, the MainWindow.xib and Skills.xib. On the MainWindow.xib I have an NSPopUpButton and a NSButton to open up the second window, the Skills.xib. This code works great bellow to open the new window. The Skills window has a SkillsPreset controller that is a subclass of NSWindowController (hope I said all that right).
Now the problem... On the skills window I have an NSButton 'AddSkill' and an NSTextField called 'addSkillTextField'. The goal is to type in to this TextField something like 'Sword' and then press the 'AddSkill' button and with this code bellow add it to the NSPopUpButton
The NSPopUpButton on the MainWindow is binded to controller class called 'TableViewController'. In the second 'Skills' window I added an Object and assigned it to 'TableViewController' so I could connect the TextField and the NSButton to the same controller class thinking they would see each other. (I don't know if this is the right way of doing it, or if I am close).
But when I fill in the text field and press the add button it fails to add the new item to the NSPopUpButton? This worked in my last project but I only had 1 .xib window, not 2.
Code:
- (IBAction)skillWindowButton:(id)sender {
if (!skillPrefs) {
skillPrefs = [[SkillsPreset alloc] initWithWindowNibName:@"Skills"];
}
[skillPrefs showWindow:self];
}
Code:
- (IBAction)addSkillToCombatButton:(id)sender {
[skillsCombatPopUpButton addItemWithTitle:[addNewSkillTextField stringValue]];
}
But when I fill in the text field and press the add button it fails to add the new item to the NSPopUpButton? This worked in my last project but I only had 1 .xib window, not 2.