Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Dec 18, 2018 4:02 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Global Properties in Cocoa
PostPosted: Sun Dec 16, 2012 8:49 pm 
Offline

Joined: Fri Jul 21, 2006 12:28 am
Posts: 509
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
 Profile  
Reply with quote  
 Post subject: Re: Global Properties in Cocoa
PostPosted: Sun Dec 16, 2012 9:42 pm 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
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
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: Global Properties in Cocoa
PostPosted: Sun Dec 16, 2012 11:08 pm 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
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.

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: Global Properties in Cocoa
PostPosted: Mon Dec 17, 2012 2:38 am 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
And events may happen in a different order in cocoa than in carbon.


Top
 Profile  
Reply with quote  
 Post subject: Re: Global Properties in Cocoa
PostPosted: Tue Dec 18, 2012 7:38 am 
Offline

Joined: Fri Jul 21, 2006 12:28 am
Posts: 509
Thanks for the responses. I'll add a constructor and see if that solves the problem with the properties.

As for the threads, one of them populates a listbox and updates a progress bar, so I suppose that would be updating the UI from a thread.

_________________
Regards,
Carl
Capaho Web
http://www.capaho.com


Top
 Profile  
Reply with quote  
 Post subject: Re: Global Properties in Cocoa
PostPosted: Tue Dec 18, 2012 10:10 am 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
capaho wrote:
Thanks for the responses. I'll add a constructor and see if that solves the problem with the properties.

As for the threads, one of them populates a listbox and updates a progress bar, so I suppose that would be updating the UI from a thread.

Yes that would be

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: Global Properties in Cocoa
PostPosted: Sat Dec 22, 2012 12:37 pm 
Offline

Joined: Sun Jan 22, 2006 2:37 am
Posts: 327
Hi,

Huh, you cannot adjust a UI from a thread? But thats the only way a progress bar and some other things are supposed to work as far as I knew. I also populate a listbox from a thread and why are you not supposed to do that? My app is running as cocoa so it seems to work but I am wondering why your not supposed to update a UI from a thread? Could someone explain that?

Grant


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group