Re: Cocoa window initially hidden in IB?
Re: Cocoa window initially hidden in IB?
- Subject: Re: Cocoa window initially hidden in IB?
- From: Yann Bizeul <email@hidden>
- Date: Thu, 27 Oct 2005 17:53:46 +0200
Yes, this is not checked, and that's not the issue.
If it is not checked, the window should not open until asked to.
I can think of about a million reasons why I would want to display
(not open) the window myself, and none for not making this facility
available.
In Cocoa, a window is generally prepared offscreen until it receives
a makeKeyAndOrderFront (or similar) message, I'm not sure, but the
real drawing of the window does not occure until it is on screen, but
this is gnerally not a problem as soon as all NSViews are ready.
Your "awakeFromNIB" option sounds like a good idea, but I'm not
sure how to keep the process from continuing until the page has
finished loading.
Just put your offscreen loading code in it, it will be executed, and
the window won't open until you send it a makeKeyAndOrderFront:
message, when you receive the notification that the page is fully
loaded. To do this, you will have to register for the notification in
your awakeFromNib method, and call something like webViewDidLoad: in
your NSNotification.
- (void)awakeFromNib
{
// Do prepare and load your webview here
[[NSNotificationCenter defaultCenter]addObserver: self
selector: @selector
(webViewDidLoad:)
name:
WebViewProgressFinishedNotification
object: myWebView];
}
- (void)webViewDidLoad:(NSNotification*)aNotification
{
[theWindow makeKeyAndOrderFront: self];
}
I hope I'm clear :-)
Yann Bizeul • yann at tynsoe.org
Cocoa Developer
Tynsoe Projects
BuddyPop • GeekTool • SSH Tunnel Manager • ...
http://projects.tynsoe.org/
Le 27 oct. 05 à 17:40, a.d. jensen a écrit :
On Oct 27, 2005, at 10:16 AM, Yann Bizeul wrote:
In IB, you have a checkbox in window's inspector called "Visible
at launch time" :
This will make the window not open when you launch the application.
Yes, this is not checked, and that's not the issue.
but I can't figure out for the life of me how to tell IB to not
display the window when it is opened.
Yeah, when you ask AppKit to open a window... it displays it, that
makes sense to me :-)
I can think of about a million reasons why I would want to display
(not open) the window myself, and none for not making this facility
available.
I'm a Carbon programmer who is making a (small) move towards doing
Cocoa programming, so I'm used to being able to control when a
window becomes visible to the user. Generally, this is to allow me
to muck around with the contents before the user sees them.
In the case that I'm working with here, I don't want the window to
display until the page has finished loading for two reasons:
1) The first time the application launches and loads my page, I
don't want a big old white screen to show up -- I'd like the
initial view to be of my completed web page.
2) Whenever there is a javascript popup window called, it opens in
the full size, then resizes to what the javaScript:Open call
intended after the page loads. This causes a flashing/flicker on
the screen that is incredibly annoying. If the window wasn't
visible until it has loaded, it would appear in the correct size
straight away.
Your "awakeFromNIB" option sounds like a good idea, but I'm not
sure how to keep the process from continuing until the page has
finished loading.
dale
--
email@hidden http://adjensen.aatrix.com
Only a fool turns away from an angel,
Vision in white steps through the door,
Holds out her hand, I say 'No I'm not ready'
I open my eyes and let the dream fade away.
-- echolyn, "on any given nite"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden