Hello everyone. Long time without questions, got a new one.
I'm trying to create my own NSControl, which is a fair bit complicated. I guess the best analogy is mention NSDatePicker, which has both the text field, and the stepper control beside it. What I want, is a single NSControl subclass with a text field and a popup button.
This is what I've done so far. I placed an NSView in the window, then placed both a text field and a popup button inside that NSView. I chose an NSView to enclose these objects since there isn't an NSControl option. I set the class of the NSView to my NSControl subclass, and connected the NSTextField, NSNumberFormatter, and NSPopUpButton to the appropriate IBOutlets within my subclass.
Obtaining the values selected and entered into these controls works fine, but I'm unable to set the initial properties of these 3 embedded controls. I put a few line of code into the awakeFromNIB method of my NSControl to set initial properties for the NSNumberFormatter and PopupButton, but those properties are never passed to those controls. The other thing, is that when I tried to access properties of the NSNumberFormatter in the awakeFromNIB method, I got an EXC_BAD_ACCESS.
The first question is, did I totally go about this the wrong way? Second question is, why can't I set/access values to my sub-controls during initialization?
I'm trying to create my own NSControl, which is a fair bit complicated. I guess the best analogy is mention NSDatePicker, which has both the text field, and the stepper control beside it. What I want, is a single NSControl subclass with a text field and a popup button.
This is what I've done so far. I placed an NSView in the window, then placed both a text field and a popup button inside that NSView. I chose an NSView to enclose these objects since there isn't an NSControl option. I set the class of the NSView to my NSControl subclass, and connected the NSTextField, NSNumberFormatter, and NSPopUpButton to the appropriate IBOutlets within my subclass.
Obtaining the values selected and entered into these controls works fine, but I'm unable to set the initial properties of these 3 embedded controls. I put a few line of code into the awakeFromNIB method of my NSControl to set initial properties for the NSNumberFormatter and PopupButton, but those properties are never passed to those controls. The other thing, is that when I tried to access properties of the NSNumberFormatter in the awakeFromNIB method, I got an EXC_BAD_ACCESS.
The first question is, did I totally go about this the wrong way? Second question is, why can't I set/access values to my sub-controls during initialization?