New topic: 

Global Properties in Cocoa

<http://forums.realsoftware.com/viewtopic.php?t=46259>

         Page 1 of 1
   [ 4 posts ]                 Previous topic | Next topic          Author  
Message        capaho          Post subject: Global Properties in CocoaPosted: 
Sun Dec 16, 2012 8:49 pm                         
Joined: Fri Jul 21, 2006 12:28 am
Posts: 475                I'm trying to run an existing project in the debugger 
as a Cocoa build.  I had to move threads I was using to handle some complicated 
processes into methods just to get the app to launch.  If I use threads, the 
app launches with an invisible window and freezes, requiring a force quit.

Now I have a problem where global properties that are given values in the 
window's open event result in NilObjectException errors when the app attempts 
to run.  It appears that the global properties are not being set in the open 
event as they should be.  I have to declare the values in each method and set 
their values there in order to get the app to run.  

Are global properties not allowed in Cocoa or is the beta implementation of 
Cocoa not handling global properties or window events correctly?      
_________________
Regards,
Carl
Capaho Web
http://www.capaho.com  
                             Top                DaveS          Post subject: 
Re: Global Properties in CocoaPosted: Sun Dec 16, 2012 9:42 pm                  
               
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4335
Location: San Diego, CA                Global variables are most certainly 
allowed in Cocoa.. and work exactly the same way (as far as I can see) as they 
do in Carbon.

When you say you get a NIL EXCEPTION... I am assuming you are initializing 
OBJECT/CLASS instances... not simple string or numeric values (since those can 
not be NIL).

You mentioned that you have code to initialize them in the OPEN event (of a 
window?)...... but they ARE defined as PUBLIC variables in a MODULE right?  
Variables defined only in the scope of a WINDOW are valid only while that 
WINDOW is active (and has it self been initialized).      
_________________
Dave Sisemore
MacPro, OSX Lion 10.7.4 RB2012r1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                npalardy          Post subject: 
Re: Global Properties in CocoaPosted: Sun Dec 16, 2012 11:08 pm                 
      Real Software Engineer          
Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7603
Location: Canada, Alberta, Near Red Deer                capaho wrote:I'm trying 
to run an existing project in the debugger as a Cocoa build.  I had to move 
threads I was using to handle some complicated processes into methods just to 
get the app to launch.  If I use threads, the app launches with an invisible 
window and freezes, requiring a force quit.
This is usually a sign that you'r manipulating the UI from a thread - which is 
a no no that causes ALL kinds of badness (like you're seeing)

capaho wrote:Now I have a problem where global properties that are given values 
in the window's open event result in NilObjectException errors when the app 
attempts to run.  It appears that the global properties are not being set in 
the open event as they should be.  I have to declare the values in each method 
and set their values there in order to get the app to run.  

Are global properties not allowed in Cocoa or is the beta implementation of 
Cocoa not handling global properties or window events correctly?
Try setting them in the constructor (if you have one)

Remember that the WINDOWS open event runs AFTER all control open events - and 
that manipulating the value of a control to set it up MAY cause events to 
happen.      
_________________
My web site Great White Software
RBLibrary.com REALbasic learning  
                             Top                timhare          Post subject: 
Re: Global Properties in CocoaPosted: Mon Dec 17, 2012 2:38 am                  
       
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 11894
Location: Portland, OR  USA                And events may happen in a different 
order in cocoa than in carbon.   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 4 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to