[baseten-users] How to use a single BXDatabaseContext object with multiple nib files

Réjean Lamy rejean.lamy at mac.com
Sun May 24 18:48:23 EEST 2009


Hi

> If the database context has also been set to connect on - 
> awakeFromNib, it might connect before the other nib has been loaded.


My application main window had tables with the BX Array Controllers  
and buttons to load the other nibs, so yes, when a nib is loaded, the  
context is already connected.
I realize we can't pass an already connected context to a new nib and  
use it with the nib's BX Array Controllers, right ?

I experimented with making the connection to context only when the nib  
finish loading and it works. At this instant, all the BX Array  
Controllers both on the main window and the nib works correctly. But  
this is not the desired behavior. I need the main window working with  
its  BX Array Controllers connected to the context and, only on  
demand, loading a nib and passing the already connected context to  
this nib.

How can I handle this situation ?

Rejean Lamy



Le 09-05-19 à 12:41, Tuukka Norri a écrit :

> Hi!
>
> Réjean Lamy kirjoitti 19.5.2009 kello 0.54:
>> Same result :(
> Like Daniel wrote, you should be able to use multiple contexts by  
> setting up BXSynchronizedArrayController's databaseContext binding.  
> However, see this thread if you use garbage collection: http://www.cocoabuilder.com/archive/message/cocoa/2009/2/24/230923
>
>> One of the strange thing I observed is about fetch.
>> When I used a BXDatabaseContext object directly in the nib, a table  
>> is populated with DB data automatically when the window is showed.
>>
>> But when I use a BXDatabaseContext instance in the main controller  
>> and passing the ctx to the nib, the table is _not_ populated with  
>> DB data.
>> In that case I must use a Fetch button.
>>
>> Strange because, in either case, the "Fetch On Connect" was always  
>> checked on the BX Array Controller driving the NSTable.
> If the database context has also been set to connect on - 
> awakeFromNib, it might connect before the other nib has been loaded.  
> Currently BXSynchronizedArrayController only observes connection  
> notifications, so you might need to either connect or fetch manually.
>
> We could make the array controller check on -awakeFromNib whether  
> its context is already connected, though.
> -- 
> Best regards,
> Tuukka Norri
> MK&C
>
> _______________________________________________
> baseten-users mailing list
> baseten-users at lists.basetenframework.org
> http://lists.basetenframework.org/mailman/listinfo/baseten-users




More information about the baseten-users mailing list