Resizing an NSBox/multiple control sets
Resizing an NSBox/multiple control sets
- Subject: Resizing an NSBox/multiple control sets
- From: John Scalo <email@hidden>
- Date: Mon, 26 Aug 2002 23:48:58 -0700
I have a window where I want to give the user a variable number of rows of
controls, a la the Edit Rule window in Entourage (and similar in other mail
programs). Rather than create all the necessary controls and connections
dynamically, I thought it might be easier to create several clones ahead of
time, place each of them in an NSBox, and change the size of the NSBox to
0x0 in IB. Then, when the user clicks the Add button, I dynamically resize
and place the NSBox, also resizing the window as necessary.
Sounds like a good plan, but I can't get the appearance of the NSBox to
change at all. I'm using code like this
IBOutlet id aBox;
- (IBAction)addABox:(id)sender
{
NSRect frame;
frame.size.width = 451;
frame.size.height = 37;
frame.origin.x = 81;
frame.origin.y = 47;
[aBox setFrameFromContentFrame:frame];//tried [NSView setFrame] as well
[aBox setBounds:frame];
[aBox sizeToFit];
[aBox setNeedsDisplay:YES];
}
I've tried several permutations of setBounds/Frame calls to NSBox and NSView
with no luck.
What am I doing wrong? Or is there a better strategy altogether to deal with
revealing multiple sets of similar controls? I've done this in Carbon by
placing the controls off-window, and while this looks possible in IB I don't
see any easy way to get to the hidden controls later like you can with
Resorcerer via "select hidden".
Thanks
- John
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.