Re: Re[2]: Control Over IB 'Visible At Launch Time' Flag
Re: Re[2]: Control Over IB 'Visible At Launch Time' Flag
- Subject: Re: Re[2]: Control Over IB 'Visible At Launch Time' Flag
- From: publiclook <email@hidden>
- Date: Thu, 14 Aug 2003 13:45:13 -0400
I would like to write a comprehensive Cocoa reference, but I look at
Apple's documentation and wonder how I could do better. Mr. Drake made
several comments below that leave me hoping he can show me how to do
better than Apple.
On Thursday, August 14, 2003, at 12:16 PM, Lance Drake wrote:
Instead of messing with the flag, turn 'visible at launch time' off
and leave it off, then in your -awakeFromNib method, if you decide
you want to display the window, call -makeKeyAndOrderFront: on it,
and if you decide you don't want to display the window, just do
nothing.
Hope this helps,
- Greg
Hi Greg,
Good golly that really DOES help. I have several Cocoa books here
and some of them don't even have the WORD 'nib' in the index - none of
them mention this flag, it's true influence, scope or
nib is not the sort of word that automatic indexers are likely to
include in an index. I think it likely that all books on Cocoa
programming describe nibs. I guess I always found the Set Visible At
Launch self explanatory, but your confusion and feedback help me
understand what else needs to be said about it. It is also worth
mentioning that it should have been called Set Visible at nib Load Time.
access to it's state. It's really amazing how difficult it is
sometimes to put together a scenario for how it is one is supposed to
do what you would wish.
- awakeFromNib is explained in many books and in Apple's documentation:
http://developer.apple.com/documentation/Cocoa/Reference/
ApplicationKit/ObjC_classic/Protocols/NSNibAwaking.html
I found it clear from the lengthy description and example that windows
are already fully initialized (including visible if set to be visible
at launch time) by the time -awakeFromNib os called. Can you help me
understand what additional details need to be explained in the
reference manual ?
For instance, 'setTitle' worked fine on the NSWindow pointer I was
able to derive - so I knew I was looking at the correct NSWindow
object. But calls like 'display', 'close' and other supposedly
reasonable commands did not seem to have any effect.
- (void)display
Passes a display message down the receivers view hierarchy, thus
redrawing all NSViews within the receiver, including the frame view
that draws the border, title bar, and other peripheral elements.
You rarely need to invoke this method. NSWindows normally record which
of their NSViews need display and display them automatically on each
pass through the event loop.
See Also: display (NSView), displayIfNeeded, isAutodisplay
I understand the above description of NSWindow's -display method to
indicate that it causes the views contained within a window to be
displayed, but I see how you might assume that makes the window itself
visible too.
- (void)orderFront:(id)sender
This action method moves the receiver to the front of its level in the
screen list, without changing either the key window or the main window.
See Also: orderBack:, orderOut:, orderWindow:relativeTo:,
makeKeyAndOrderFront:, level
I see that the above description should say, "and makes the window
visible if it is not already visible." I guess I just implicitly
understood that -orderOut: lakes a window out of the "screen list" of
visible windows and -orderFront: moves a window to the end (top) of the
list list of visible windows adding the window to the list if necessary.
- (void)close
Removes the receiver from the screen. If the receiver is set to be
released when closed, a release message is sent to the object after the
current event is completed. For an NSWindow object, the default is to
be released on closing, while for an NSPanel object, the default is not
to be released. You can use the setReleasedWhenClosed: method to change
the default behavior.
A window doesnt have to be visible to receive the close message. For
example, when the application terminates, it sends the close message to
all windows in its window list, even those that are not currently
visible.
The close method posts an NSWindowWillCloseNotification to the default
notification center.
The close method differs in two important ways from the performClose:
method:
It does not attempt to send a windowShouldClose: message to the
receiver or its delegate.
It does not simulate the user clicking the close button by momentarily
highlighting the button.
Use performClose: if you need these features.
See Also: orderOut:
I have no idea why -close would not work for you. can you elaborate ?
Thanks SO much for your excellent and timely advice.
I am curious how I could write a manual that also provides the
excellent advice? I guess it just naturally occurs to me that if I
don't want a window to always be visible at launch time I should not
set the visible at launch time option in Interface Builder, but not
everyone thinks alike or has the same background and pre-expectations.
Can you suggest other areas where you either don't think Apple's
documentation tells you what you need to know or you cant find what you
want in the documentation ?
_______________________________________________
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.