> > >>>It says something about TStringList property Strings not being > > >>>published... > > >> > > >>You will get this error when loading a form with DB (related) components > > >>with an Active=True property and the connection to the DB fails. > > > > > > > > > Doew anyone has any ideas how to solve that? I can remove the error, if > > > the dataset is opened while the component is 'loading', but then an > > > application will also silently close the database, without any error- > > > message? > > > > I think an error mesage must be shown (in design mode always, in runtime > > depending on the OnError handler) > > In design mode it may not result in an exception, and the db should stay > > closed. In runtime an exception is OK unless handled on the OnError > > The TDataset, TDatabase and TTransaction components can't show a > messagedialog, since they are part of the FCL. > > So I can suppress the exception. But then you'll never know why it's > impossible to set the active property to true, when you are in design > time. > > Maybe that you can change it on the lazarus side: in the except-block, > take care of the EDatabaseError exceptions. (ie: show the message, and > don't reraise it)
In the attachment there is a patch which does this. Maybe that there should be an extra try-block around the reader.ReadRootComponent, because now the DoFinishReading isn't called. (what does that do?) But the result of the patch is nice - with a messagebox with the DB-error as a result. But i'm not that into jitforms - so I could have missed something... Joost
Index: designer/jitforms.pp =================================================================== --- designer/jitforms.pp (revision 7963) +++ designer/jitforms.pp (working copy) @@ -210,6 +210,8 @@ implementation +uses db; + {$IFOPT R+}{$DEFINE RangeCheckOn}{$ENDIF} //------------------------------------------------------------------------------ @@ -687,6 +689,9 @@ Reader.Free; end; except + on E: EDatabaseError do begin + MessageDlg(E.Message,mtError,[mbOK],0); + end ; on E: Exception do begin DebugLn('[TJITComponentList.AddJITChildComponentFromStream] ERROR reading form stream' +' of Class ''',NewClassName,''' Error: ',E.Message);