Skip navigation.
 
mlAutomatically Call a Function
FROM : Philip Lee Bridson
DATE : Sun Jun 15 19:09:34 2008

Hi there - sorry this is actually two questions in one.


Firstly I need a function to automatically run from a class used in 
MainMenu.nib when the main.m calls NSApplicationMain();

Also, I cannot figure out why when I initialize a window from a nib 
or from a file before the call to NSApplicationMain() the program 
crashes due to a memory leak. Please see below.

I have the usual: "return NSApplicationMain;" in the main file and it 
loads the correct nib file absolutely fine. But then I want it to 
perform certain functions, close itself and open a new window all 
without user intervention. I can get it to do what I want but at the 
moment the user has to push a button on the first window to kick off 
the process, I would like to skip the need for user intervention.

I have tried to put the function in awakeFromNib but then the window 
wont close itself from that function. I have also tried putting my 
first window before the call to NSApplicationMain but then the 
application crashes due to a memory leak, I have tried using an 
autorelease pool and still it crashes when I try to initialize the 
window. I tried both loading the window from nib file and a 
programmed class but it just keeps crashing

Does anyone have any ideas as I have searched the docs and web and I 
am still stuck - is there something I am missing?

Many thanks for any help that you can give.

Phil.

Related mailsAuthorDate
mlAutomatically Call a Function Philip Lee Bridson Jun 15, 19:09
mlRe: Automatically Call a Function Stephen J. Butler Jun 15, 20:29
mlRe: Automatically Call a Function Marcel Weiher Jun 15, 20:31
mlRe: Automatically Call a Function Philip Lee Bridson Jun 15, 22:59
mlRe: Automatically Call a Function Ken Thomases Jun 15, 23:16
mlRe: Automatically Call a Function Philip Lee Bridson Jun 15, 23:25