Need help again (Re: Need help : Multiple views in NSDrawer)
Need help again (Re: Need help : Multiple views in NSDrawer)
- Subject: Need help again (Re: Need help : Multiple views in NSDrawer)
- From: kubernan <email@hidden>
- Date: Tue, 23 Jul 2002 21:01:52 +0200
Thx a lot for your suggestion.
I decided to create multiple NSDrawer (your first suggestion)... But i
have the same problem :
even if i can open my drawer, its content is empty.
Here's my new code :
=== theParentWindowController.h === contains (with other things) :
NSDrawer *oneView; // obtain calling the drawer controller
id ForStandardView; // the drawer controller - see forStandardView.h
=== theParentWindowController.m ===
-(void)openMyDrawerWithXView
{
NSSize frameSize = {605,157};
oneView = [[[self ForStandardView] standardDrawer]
initWithContentSize:frameSize preferredEdge:NSMaxYEdge];
// Note : if i use : oneView = [[self ForStandardView]
standardDrawer] - the drawer opens with black view.
if (oneView == nil)
NSLog(@"theDrawer is nil"); // I don't have this message during
execution
[oneView setParentWindow:[self window]];
[oneView open]; // -->>> It opens but content is empty
[[oneView contentView] setNeedsDisplay:TRUE];
}
=== forStandardView.h === the controller of the drawer content
@interface forStandardView : NSObject
{
IBOutlet id tbutton;
IBOutlet id standardDrawer;
IBOutlet id myView; // Built in Interface Builder this is the view
for the Drawer. It contains a textfield
// and a button (tbutton) but it doesn't appear
during execution
}
- (IBAction)hello:(id)sender;
-(NSDrawer *)standardDrawer;
@end
=== forStandardView.m === The controller of the drawer content
@implementation forStandardView
- (id)init
{
NSSize frameSize = {605,157};
self = [super init];
NSLog(@"Init - forStandardView");
standardDrawer = [[NSDrawer alloc] initWithContentSize:frameSize
preferredEdge:NSMaxYEdge];
return self;
}
- (IBAction)hello:(id)sender
{
}
-(NSDrawer *)standardDrawer
{
NSSize frameSize = {605,157};
[standardDrawer setMaxContentSize:frameSize];
[standardDrawer setContentView:myView];
return standardDrawer;
}
@end
Le jeudi 1 janvier 1970, ` 01:57 AM, Roarke Lynch a icrit :
>
I would suggest doing one of two things (at least this is I would
>
implement it)
>
>
(1) create three separate drawers, and control which is out
>
progamtically. This would prob be to slow
>
or
>
(2) in your drawers place a tab view without the tabs and promatically
>
control which tab is visable
>
>
On Monday, July 22, 2002, at 06:19 PM, kubernan wrote:
>
>
> Hello,
>
>
>
> I'd like to do some interesting things with my parent window and its
>
> drawer but
>
> i have some difficulties :
>
>
>
> The content of the drawer can have different views depending on what
>
> we select
>
> in the parent window. For example :
>
> Selection x in parent window --> open the drawer with the view x (and
>
> its content)
>
> Selection y in parent window --> open the drawer with the view y "
>
> Selection z in parent window --> open the drawer with the view z "
>
>
>
> What i decided to do is to create 3 subclasses view, called (following
>
> the
>
> example) x y and z.
>
> I also create 3 controllers, each contains an outlet connected to the
>
> appropriate view :
>
> controller x has the view x.
>
>
>
> I generate the file for the controllers and the views.
>
> Now i have to display the selected view in my drawer and this is where
>
> i have difficulties : the
>
> selected view and its content doesn't appears in the drawer.
>
>
>
> It seems i have to do something like that.
>
>
>
> theParentWindowController.m
>
>
>
> -(void)openMyDrawerWithXView
>
> {
>
> id selectedController = nil;
>
> id viewX;
>
> selectedController = [[[theXController alloc] init] retain];
>
> viewX = [[IBView alloc] initWithFrame:[[myDrawer contentView]
>
> frame]];
>
> [myDrawer setContentView:viewX];
>
> [myDrawer open];
>
> }
>
>
>
> There are two problems :
>
>
>
> 1- As I said, the drawer seems to be empty :-(
>
>
>
> 2- Other thing i don't understand : I have a log message (NSLog) in
>
> the theXController init method. It appears the log message is
>
> displayed twice : first time when the parent window controller (the
>
> "main" controller) is loaded + after calling the openMyDrawerWithXView
>
> method.
>
>
Roarke Lynch
>
-------------------------------
>
email@hidden
>
_______________________________________________
>
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.
_______________________________________________
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.