FROM : Ken Worley
DATE : Wed Feb 27 22:46:11 2008
On Feb 27, 2008, at 2:25 PM, Daniel Child wrote:
> I am trying to place and size segmented controls programmatically on
> a window controlled by a subclass of NSWindowController. What I'm
> getting, however, is simply the window as it was initially drawn in
> IB. I think the problem has to do with loading the window properly
> and more specifically, getting the segmented control variables to
> know which window they are being redrawn in.
>
> I declared an outlet "window" to match the nib outlet (window), and
> also physically drew in dummy controls on within IB. When I try to
> actually ruun the program and init the window controller using
> initWithNibName:, I notice that "window" has no memory associated
> it. Since I want to size my controls programmatically, this seems to
> be a problem, since their "_window" variable is naturally also null
> as a result. The controls are initially drawn in IB but are suppose
> to resize during -windowWillLoad.
>
> In addition, I see that in the debugger there is both a "window" and
> a "_window" variable under self (the controller). Does this mean you
> are not supposed to formally declare an outlet for the controller's
> window?
>
> Bottom line, I am getting a window that looks like what I drew in
> IB, not the one modified programmatically.
>
> I feel I am going about this the wrong way but don't see any
> documentation on this particular issue. If anyone could shed some
> light on the procedure, it would be a big help. Thanks.
>
I'm going through some of the same stuff and it's not easy. It's hard
for me to tell how far along you are, but some of Apple's sample code
has helped me with programmatic creation of controls and their
placement in the window. ButtonMadness in particular uses placeholders
for some controls in the window nib and replaces them with
programmatically created controls at runtime.
Ken
--
Ken Worley
Software Engineer, Tiberius, Inc.
DATE : Wed Feb 27 22:46:11 2008
On Feb 27, 2008, at 2:25 PM, Daniel Child wrote:
> I am trying to place and size segmented controls programmatically on
> a window controlled by a subclass of NSWindowController. What I'm
> getting, however, is simply the window as it was initially drawn in
> IB. I think the problem has to do with loading the window properly
> and more specifically, getting the segmented control variables to
> know which window they are being redrawn in.
>
> I declared an outlet "window" to match the nib outlet (window), and
> also physically drew in dummy controls on within IB. When I try to
> actually ruun the program and init the window controller using
> initWithNibName:, I notice that "window" has no memory associated
> it. Since I want to size my controls programmatically, this seems to
> be a problem, since their "_window" variable is naturally also null
> as a result. The controls are initially drawn in IB but are suppose
> to resize during -windowWillLoad.
>
> In addition, I see that in the debugger there is both a "window" and
> a "_window" variable under self (the controller). Does this mean you
> are not supposed to formally declare an outlet for the controller's
> window?
>
> Bottom line, I am getting a window that looks like what I drew in
> IB, not the one modified programmatically.
>
> I feel I am going about this the wrong way but don't see any
> documentation on this particular issue. If anyone could shed some
> light on the procedure, it would be a big help. Thanks.
>
I'm going through some of the same stuff and it's not easy. It's hard
for me to tell how far along you are, but some of Apple's sample code
has helped me with programmatic creation of controls and their
placement in the window. ButtonMadness in particular uses placeholders
for some controls in the window nib and replaces them with
programmatically created controls at runtime.
Ken
--
Ken Worley
Software Engineer, Tiberius, Inc.
| Related mails | Author | Date |
|---|---|---|
| Daniel Child | Feb 27, 22:25 | |
| Ken Worley | Feb 27, 22:46 | |
| Quincey Morris | Feb 28, 00:34 | |
| Ken Thomases | Mar 1, 12:02 |






Cocoa mail archive

