Why resizing doesn't work for me ?
-
Hello,
Because i had no response, i repost the same question : i don't find
solution.
If i display more than one instance of the same window and call a resize
function in my program,
the second window is resizing instead of the first one.
First window Second window third window
call resize
I ^
I I
I I
+--- applied here (!)------------+ <== wrong !!
Here's a part of my code :
------ Create.m ---------
- (id)init {
self = [super init];
if (![NSBundle loadNibNamed:@"CreateWindow" owner:self]) {
NSLog(@"Can't launch : CreateWindow.nib");
[self release];
}
}
- (void)awakeFromNib
{
[myParentWindow makeKeyAndOrderFront:self];
}
-(void)someStuff
{
// some code
if (count == 1)
[self modSize];
}
- (void)modSize
{
NSRect oldFrame = [myParentWindow frame];
NSRect
frame={{oldFrame.origin.x,oldFrame.origin.y-150},{oldFrame.size.width,oldFrame.
size.height+150}};
[myParentWindow setFrame:frame display:YES animate:YES];
}
- (NSWindow *)myParentWindow
{
return myParentWindow;
} -
On Tuesday, December 4, 2001, at 01:20 AM, kubernan wrote:
> Hello,
>
> Because i had no response, i repost the same question : i don't find
> solution.
>
> If i display more than one instance of the same window and call a
> resize function in my program,
> the second window is resizing instead of the first one.
>
> ------ Create.m ---------
> - (id)init {
>
> self = [super init];
>
> if (![NSBundle loadNibNamed:@"CreateWindow" owner:self]) {
> NSLog(@"Can't launch : CreateWindow.nib");
> [self release];
> }
>
> }
The only possibility that occurs to me off-hand is that you are calling
-init on the same object twice. This would load the nib a second time
with the same owner, and the "myParentWindow" variable would get set to
the second (last loaded) window, replacing the first window.
Could you share the code that is creating the Create objects?
Hope this helps,
--Greg -
On Tuesday, December 4, 2001, at 01:20 AM, kubernan wrote:
> Hello,
>
> Because i had no response, i repost the same question : i don't find
> solution.
>
> If i display more than one instance of the same window and call a resize
> function in my program,
> the second window is resizing instead of the first one.
>
> ------ Create.m ---------
> - (id)init {
>
> self = [super init];
>
> if (![NSBundle loadNibNamed:@"CreateWindow" owner:self]) {
> NSLog(@"Can't launch : CreateWindow.nib");
> [self release];
> }
>
> }
Sorry if I only caught the tail end of this discussion, but if this is
your entire init method, then perhaps the problem is as simple as not
returning self:
------ Create.m ---------
- (id)init {
self = [super init];
if (![NSBundle loadNibNamed:@"CreateWindow" owner:self]) {
NSLog(@"Can't launch : CreateWindow.nib");
[self release];
return(nil);
}
return(self);
}
--------------------------------------------------------------------------
Edward Moy
Apple Computer, Inc.
<emoy...>
(This message is from me as a reader of this list, and not a statement
from Apple.) -
Thx for your help :
See what i do in my Controller.m for creating the Create class :
- (IBAction)createTheWindow:(id)sender
{
id ctrl = [Create new];
}
That's all ! ;-)
createTheWindow is called when i click a menu item.
Le mardi 4 décembre 2001, à 07:00 PM, Greg Titus a écrit :
> On Tuesday, December 4, 2001, at 01:20 AM, kubernan wrote:
>
>> Hello,
>>
>> Because i had no response, i repost the same question : i don't find
>> solution.
>>
>> If i display more than one instance of the same window and call a
>> resize function in my program,
>> the second window is resizing instead of the first one.
>>
>> ------ Create.m ---------
>> - (id)init {
>>
>> self = [super init];
>>
>> if (![NSBundle loadNibNamed:@"CreateWindow" owner:self]) {
>> NSLog(@"Can't launch : CreateWindow.nib");
>> [self release];
>> }
>>
>> }
>
> The only possibility that occurs to me off-hand is that you are calling
> -init on the same object twice. This would load the nib a second time
> with the same owner, and the "myParentWindow" variable would get set to
> the second (last loaded) window, replacing the first window.
>
> Could you share the code that is creating the Create objects?
>
> Hope this helps,
> --Greg
> _______________________________________________
> cocoa-dev mailing list
> <cocoa-dev...>
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
>
-
Nope.... it's not due to the lack of return of the init method.
I tried with and without..same pb. :-(
Le mardi 4 décembre 2001, à 09:22 PM, Edward Moy a écrit :
> On Tuesday, December 4, 2001, at 01:20 AM, kubernan wrote:
>
>> Hello,
>>
>> Because i had no response, i repost the same question : i don't find
>> solution.
>>
>> If i display more than one instance of the same window and call a
>> resize function in my program,
>> the second window is resizing instead of the first one.
>>
>> ------ Create.m ---------
>> - (id)init {
>>
>> self = [super init];
>>
>> if (![NSBundle loadNibNamed:@"CreateWindow" owner:self]) {
>> NSLog(@"Can't launch : CreateWindow.nib");
>> [self release];
>> }
>>
>> }
>
> Sorry if I only caught the tail end of this discussion, but if this is
> your entire init method, then perhaps the problem is as simple as not
> returning self:
>
> ------ Create.m ---------
> - (id)init {
>
> self = [super init];
>
> if (![NSBundle loadNibNamed:@"CreateWindow" owner:self]) {
> NSLog(@"Can't launch : CreateWindow.nib");
> [self release];
> return(nil);
> }
> return(self);
> }
> --------------------------------------------------------------------------
> Edward Moy
> Apple Computer, Inc.
> <emoy...>
>
> (This message is from me as a reader of this list, and not a statement
> from Apple.)
>
>
>
-
On Tuesday, December 4, 2001, at 01:20 AM, kubernan wrote:
> Hello,
>
> Because i had no response, i repost the same question : i don't find
> solution.
>
> If i display more than one instance of the same window and call a
> resize function in my program,
> the second window is resizing instead of the first one.
>
> ------ Create.m ---------
> - (id)init {
>
> self = [super init];
>
> if (![NSBundle loadNibNamed:@"CreateWindow" owner:self]) {
> NSLog(@"Can't launch : CreateWindow.nib");
> [self release];
> }
>
> }
The only possibility that occurs to me off-hand is that you are calling
-init on the same object twice. This would load the nib a second time
with the same owner, and the "myParentWindow" variable would get set to
the second (last loaded) window, replacing the first window.
Could you share the code that is creating the Create objects?
Hope this helps,
--Greg -
On Tuesday, December 4, 2001, at 01:20 AM, kubernan wrote:
> Hello,
>
> Because i had no response, i repost the same question : i don't find
> solution.
>
> If i display more than one instance of the same window and call a resize
> function in my program,
> the second window is resizing instead of the first one.
>
> ------ Create.m ---------
> - (id)init {
>
> self = [super init];
>
> if (![NSBundle loadNibNamed:@"CreateWindow" owner:self]) {
> NSLog(@"Can't launch : CreateWindow.nib");
> [self release];
> }
>
> }
Sorry if I only caught the tail end of this discussion, but if this is
your entire init method, then perhaps the problem is as simple as not
returning self:
------ Create.m ---------
- (id)init {
self = [super init];
if (![NSBundle loadNibNamed:@"CreateWindow" owner:self]) {
NSLog(@"Can't launch : CreateWindow.nib");
[self release];
return(nil);
}
return(self);
}
--------------------------------------------------------------------------
Edward Moy
Apple Computer, Inc.
<emoy...>
(This message is from me as a reader of this list, and not a statement
from Apple.) -
Thx for your help :
See what i do in my Controller.m for creating the Create class :
- (IBAction)createTheWindow:(id)sender
{
id ctrl = [Create new];
}
That's all ! ;-)
createTheWindow is called when i click a menu item.
Le mardi 4 dicembre 2001, ` 07:00 PM, Greg Titus a icrit :
> On Tuesday, December 4, 2001, at 01:20 AM, kubernan wrote:
>
>> Hello,
>>
>> Because i had no response, i repost the same question : i don't find
>> solution.
>>
>> If i display more than one instance of the same window and call a
>> resize function in my program,
>> the second window is resizing instead of the first one.
>>
>> ------ Create.m ---------
>> - (id)init {
>>
>> self = [super init];
>>
>> if (![NSBundle loadNibNamed:@"CreateWindow" owner:self]) {
>> NSLog(@"Can't launch : CreateWindow.nib");
>> [self release];
>> }
>>
>> }
>
> The only possibility that occurs to me off-hand is that you are calling
> -init on the same object twice. This would load the nib a second time
> with the same owner, and the "myParentWindow" variable would get set to
> the second (last loaded) window, replacing the first window.
>
> Could you share the code that is creating the Create objects?
>
> Hope this helps,
> --Greg
> _______________________________________________
> cocoa-dev mailing list
> <cocoa-dev...>
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
-
Nope.... it's not due to the lack of return of the init method.
I tried with and without..same pb. :-(
Le mardi 4 dicembre 2001, ` 09:22 PM, Edward Moy a icrit :
> On Tuesday, December 4, 2001, at 01:20 AM, kubernan wrote:
>
>> Hello,
>>
>> Because i had no response, i repost the same question : i don't find
>> solution.
>>
>> If i display more than one instance of the same window and call a
>> resize function in my program,
>> the second window is resizing instead of the first one.
>>
>> ------ Create.m ---------
>> - (id)init {
>>
>> self = [super init];
>>
>> if (![NSBundle loadNibNamed:@"CreateWindow" owner:self]) {
>> NSLog(@"Can't launch : CreateWindow.nib");
>> [self release];
>> }
>>
>> }
>
> Sorry if I only caught the tail end of this discussion, but if this is
> your entire init method, then perhaps the problem is as simple as not
> returning self:
>
> ------ Create.m ---------
> - (id)init {
>
> self = [super init];
>
> if (![NSBundle loadNibNamed:@"CreateWindow" owner:self]) {
> NSLog(@"Can't launch : CreateWindow.nib");
> [self release];
> return(nil);
> }
> return(self);
> }
> --------------------------------------------------------------------------
> Edward Moy
> Apple Computer, Inc.
> <emoy...>
>
> (This message is from me as a reader of this list, and not a statement
> from Apple.)



