File: programming/cocoa/UKProgressPanel.zip/UKProgressPanel_02/UKProgressPanel/ProgressAppDelegate.m


/* =============================================================================
	POJECT:		UKProgressPanel
	FILE:		ProgressAppDelegate.m
	AUTHORS:	M. Uli Kusterer (UK), (c) 2003, all rights reserved.
   ========================================================================== */
 
// -----------------------------------------------------------------------------
//	Headers:
// -----------------------------------------------------------------------------
 
#import "ProgressAppDelegate.h"
#import "UKProgressPanelTask.h"
#include <unistd.h>
// This action is called by our "test" button:
// The following three actions are called in separate threads:
// Threads need one of these.
// Just some vars so we can fake a lengthy operation
	UKProgressPanelTask*		task = [UKProgressPanelTask newProgressPanelTask];	// Create a progress bar etc. in our progress panel, showing and creating a panel if necessary.
	
	// Set up the progress bar and title/status message to be shown for this task:
	[task setIndeterminate: YES];										// By default, you get a determinate scrollbar, but we want barber-pole style.
	[task setTitle: @"Inviting folks to the party"];					// Title should describe the action the user triggered, so she knows what progress bar belongs to what operation.
	[task setStatus: @"The Witnesses of TeachText are everywhere..."];	// Status is the display that changes and gives some more information than the progress bar would.
// Loop until we have xmax iterations or the user clicked the "Stop" button.
// Keep the progress bar spinning.
		usleep(500);			// short delay so user can see the tasks in the task panel. Otherwise this loop would be over before the user even notices.
	}
	
	[task release];		// Remove the progress bar, status fields etc. from the progress panel, we're finished!
	[pool release];		// Kill everything in the pool.
// doFirstProgressThing: documents most of this already.
// Set the maximum value of the scroll bar.
	[task setTitle: @"Inventing my own programming language"];
	[task setStatus: @"Not much to do here."// Change the value of the progress bar to indicate our progress.
"Learning to play the piano""Key %d.", x]];	// Just to show you that you can also display some more detailed status info.
 

This code uses the PclZip Zip File reading code, which is subject to the GNU LGPL. It also uses the GeSHi syntax highlighter, subject to the GPL. Ask if you want this for your own web site, it's free.