Multiples Views
Multiples Views
- Subject: Multiples Views
- From: Amilcar Meneses Viveros <email@hidden>
- Date: Tue, 13 Nov 2001 13:04:35 -0600 (CST)
Hello.
Some weeks ago somebody ask about hide an graphic object. I think in
multiples views (like Garfinkel and Mohoney over NeXTSTEP PROGRAMMING).
Well, I write an example. I declared 4 objects NSBox with text fields,
buttons, etc. and i declared 1 object NSBox empty:
@interface MultipleViewController : NSObject
{
IBOutlet id box1;
IBOutlet id box2;
IBOutlet id box3;
IBOutlet id box4;
IBOutlet id multipleView; // Empty box
}
- (void)awakeFromNib;
- (IBAction)chooseBox1:(id)sender;
- (IBAction)chooseBox2:(id)sender;
- (IBAction)chooseBox3:(id)sender;
- (IBAction)chooseBox4:(id)sender;
- (void)setPagToView: (id)theView;
@end
The methods sender-target choose some box.
The implementation is very simple:
@implementation MultipleViewController
- (void)awakeFromNib {
[self setPagToView: [box1 contentView]];
}
- (IBAction)chooseBox1:(id)sender
{
[self setPagToView: [box1 contentView]];
}
....
- (void)setPagToView: (id)theView
{
NSRect bRect, vRect;
bRect = [multipleView frame];
vRect = [theView frame];
vRect.origin.x = 0.0;
vRect.origin.y = 0.0;
[theView setFrame:vRect];
[multipleView setContentView: theView];
[multipleView setNeedsDisplay:YES];
}
@end
When run the example, the first time run well, but when i choose some
box again, is empty.
Anybody can help me?
Thanks.
Atte
Amilcar
"...grave en la penca de un maguey tu nombre..."