Hi Richard,
Thank You for this aknowledgment. I will keep it in my Templates
Library.
I don't own the source of the Tutorial document, so only Nicola could
modify it.
When You say :
the initWithContentRect:...
method may destroy the original window...
Does it mean sometimes it does, sometimes it does not ? How this
behaviour is predictable ?
Well, I understand I must continue to read, try and learn...
Regards,
--
Bien cordialement,
Patrick CARDONA
On 2020-06-10 12:04:11 +0200 Richard Frith-Macdonald
<[email protected]> wrote:
On 10 Jun 2020, at 10:42, Patrick Cardona via Discussion list for
the
GNUstep programming environment <[email protected]> wrote:
(2) In the method 'createWindow' :
- (void) createWindow
{
...
myWindow = [NSWindow alloc];
/* Don't make a assignment of 'myWindow' again...
myWindow = */
/* So I kept only the message... */
[myWindow initWithContentRect: rect
styleMask: styleMask
backing: NSBackingStoreBuffered
defer: NO];
The correct code here is
myWindow = [NSWindow alloc];
myWindow = [myWindow initWithContentRect: rect
styleMask: styleMask
backing: NSBackingStoreBuffered
defer: NO];
You *must* have the second assignment, because the
initWithContentRect:...
method may destroy the original window and return a new one. maybe
it would
help for the tutorial to have a comment saying that.
If you find it aesthetically displeasing to have two assignments, you
can
write the code as
myWindow = [[NSWindow alloc] initWithContentRect: rect
styleMask: styleMask
backing: NSBackingStoreBuffered
defer: NO];