|
From: jeroen <je...@fo...> - 2003-10-01 13:08:11
|
On Wednesday 01 October 2003 03:30 am, Tony wrote:
> Hello!
>
> Fox 1.1.37, Windows, Mingw.
>
>
> I'm fighting with DialogBox which is a database connection dialog, and
> main window must not appear in the case of connection fail.
> My code is:
>
> void MainWindow::create(){
> FXMainWindow::create();
> (new
> ConnectWindow(this,"Connection"))->execute(PLACEMENT_SCREEN,SKeeper); if
> (SKeeper.Connected())
> show(PLACEMENT_SCREEN);
> else
> close();
> }
>
> But application crashes at close();
>
> Why it does not work?
Close entails a call to "destroy this". If this crashes, then its likely
there are further references to the deleted object (MainWindow).
Personally, I think its best to limit create() to the realization of the
widget tree, and registering of drag types, and any other initializations
which can only be performed after the display connection is first established.
> How to close it and quit without appearing?
I Assume ConnectWindow is a dialog; why not have this be a free-floating
dialog and delay the construction/creation of MainWindow until it runs
successfully?
> Thanks for all FOXes.
>
> P.S. http://www.fox-toolkit.org/news.html shows two "1.1.36" versions.
Thanks, I'll fix that!
- Jeroen
--
+----------------------------------------------------------------------------+
| Copyright (C) 08:00 10/ 1/2003 Jeroen van der Zijp. All Rights Reserved. |
+----------------------------------------------------------------------------+
|