Re: Progress bar
Re: Progress bar
- Subject: Re: Progress bar
- From: Andrea Salomoni <email@hidden>
- Date: Fri, 11 Nov 2005 11:57:54 +0100
Thank very much I'm learning alot!
Andrea
Il giorno 11/nov/05, alle ore 11:53, Julio Cesar Silva dos Santos ha
scritto:
Well, I do not know your whole code but this message means that
your image was created outside the lines
NSAutorelease* pool = [[NSAutorelease alloc] init];
...
[pool release];
and it will not be released by the system when your application
quit and this could lead to a memory leak. Check the code to create
the image and be sure that it is created and destroyed properly.
Julio Cesar Santos
email@hidden
eMac 1GHz ComboDrive
640MB RAM
Linux User #359973
On 11/11/2005, at 08:38, Andrea Salomoni wrote:
Hi and Thank you...
All works (but I still cannot see the messages in the splash
screen maybe because is under the image... don't know...)
but when I start the app i see this type of warning in the console:
_NSAutoreleaseNoPool(): Object 0x9ede360 of class
_NSCachedBitmapImageRep autoreleased with no pool in place - just
leaking
What is this?
Thank you very much!
Andrea
Il giorno 11/nov/05, alle ore 11:16, Julio Cesar Silva dos Santos
ha scritto:
Probably because your main window is configured to be visible at
launch time (select the main window in IB and see in the
inspector if the option 'visible at launch time' is checked).
Deselect this option and it will not show, but you have to show
it programmatically when your splash screen tasks end (something
like [mainWindow makeKeyAndOrderFront]),
Julio Cesar Santos
email@hidden
eMac 1GHz ComboDrive
640MB RAM
Linux User #359973
On 11/11/2005, at 07:54, Andrea Salomoni wrote:
Thank you a lot for help this works fine... but:
When I start the application, the splash screen starts and in
the background I see the main window of the app... I would like
to wait to show the main window until splash screen is closed
and the app performed all the start up tasks...
Thank you for your help!
Andrea
Il giorno 11/nov/05, alle ore 01:58, Shawn Erickson ha scritto:
Well my example code for the threaded method wasn't a complete
example, I left a lot up to the reader. The following is little
more complete example (cannot provide much more not knowing the
side effects of having your main thread being able to process
events while you are doing your database work in a secondary
thread).
The example sticks with awakeFromNib but it is likely better to
implement applicationDidFinishLaunching: and move your code
that finished up your application launching in there. This was
written in Mail.app so likely have some syntax errors...
- (void)awakeFromNib
{
[NSThread detachNewThreadSelector:@selector(prepareDatabase)
toTarget:self withObject:nil];
}
- (void)prepareDatabase
{
NSAutorelease* pool = [[NSAutorelease alloc] init];
@try {
...create, configure and show splash window...
[myStatusField performSelectorOnMainThread:@selector
(setStringValue:)
withObject:@"Setting up database" // TODO - use
NSLocalizedString to fetch localized versions
waitUntilDone:NO];
... setup database ...
[myStatusField performSelectorOnMainThread:@selector
(setStringValue:)
withObject:@"Quering database....." // TODO - use
NSLocalizedString to fetch localized versions
waitUntilDone:NO];
... query database ...
[myStatusField performSelectorOnMainThread:@selector
(setStringValue:)
withObject:@"Done" // TODO - use NSLocalizedString to fetch
localized versions
waitUntilDone:NO];
... order out and release splash window ...
} @finally {
[pool release];
}
}
The "@try" and "@finally" are enabled as part of Objective-C
exceptions in the build settings. Just comment those out if you
don't care or want to use them.
-Shawn
On Nov 10, 2005, at 3:17 PM, Andrea Salomoni wrote:
Hi,
Thank you very much for reply.
I tryied to use your method... but it still doesn't work.
Il giorno 11/nov/05, alle ore 00:06, Shawn Erickson ha scritto:
For this scenario your options are to explicitly trigger the
view element to draw itself (likely best to use
displayIfNeeded) or rework things such that your long run
body of work takes place in a secondary thread. Using a
secondary thread for this work will allow the main thread to
do its normal event loop which includes asking dirty views to
redraw themselves.
If you do want to use a secondary thread then to update
status use something like the following...
[myStatusField performSelectorOnMainThread:@selector
(setStringValue:)
withObject:@"Setting up database"
waitUntilDone:NO];
... setup database ...
[myStatusField performSelectorOnMainThread:@selector
(setStringValue:)
withObject:@"Quering database....."
waitUntilDone:NO];
...
Personally I would use a secondary thread for this.
-Shawn
_______________________________________________
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