[baseten-users] How do i display custom error messages?

Raffaele Candeliere candeliere at trendengineering.it
Mon Dec 14 19:19:50 EET 2009


Hi everybody!
First of all, i apologize for the maybe trivial question, but i can't find any hint. I've googled around without any appreciable result.
I'm migrating an application from PHP/P4A/Postgres to Cocoa/Baseten/Postgres. 
Well, i can't find a way to present the user with custom alert windows in case of errors.
As an example let's assume we have a TableView fed with an BXSynchronizedArrayController. The first column of this TableView displays also the primary key for the
associated database table (entity) because the user must be able to modify it.
Far too obvious: we must check for primary key constraint violations before letting the input data reach the underlaying database table.
All my constraints are already in the database, already set up and tested. Foreign key, Primary keys, consistency check, etc. All perfectly working. 
Now the problem is: do i let postgres do all the dirt stuff?
In this case i can't find a way to notify the user of the error messages coming from the databasecontext: everything is logged in the console. No visual hint.
The other approach would be to check things in the GUI BEFORE the data reach the underlaying database.
But also in this case i get strange behaviors.
If i use the "isValidObject" approach of the NSControlTextEditingDelegate protocol i can check things *before* the stuff gets to the BaseTen framework BUT the cocoa
framework keeps on presenting its own error messages. I always get my modal alert panel (made with a NSRunCriticalAlertPanel call) PLUS the "Formatting error" panel presented by the cocoa framework.
The cocoa dev documentation says that we should return NO from isValidObject to cancel user changes, but in this case i always get the already mentioned cocoa alert.
May be there's a "middle" way in which BaseTen displays Alert windows but i don't understand how. 
I can see a "ModalWindow" IBOutlet in the BXSynchronizedArrayController IBPlugIn but i really cannot understand how this can be used or customized.

Thank you all very much in advance for the help

 


More information about the baseten-users mailing list