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

Tuukka Norri tuukka.norri at karppinen.fi
Tue May 19 19:41:21 EEST 2009


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



More information about the baseten-users mailing list