Re: Kill fox-Toolkit while initialize
Jeroen van der Zijp <[email protected]>
| Newsgroups | gmane.comp.lib.fox-toolkit.user |
|---|---|
| Organization | FOX Toolkit |
| Message-ID | <20220423104324.32e16449@leviathan> |
On Sat, 23 Apr 2022 15:31:10 +0200 Ingo Foerster <[email protected]> wrote: >Hello, >currently I run against a problem with Fox-Toolkit. >I try to end a dialog while it is intialized. > >Code: >KDataFOXLibDlg::KDataFOXLibDlg(FXApp *app, const FXString &title) >: FXDialogBox(app, title, DECOR_ALL, 0, 0, 600, 500, 0, 0, 0, 0, 0, 0) >{ > >int res = 0; >if(res == 0){ >FXMessageBox::error(app, MBOX_OK, "Messagebox", "Error"); >::exit(0); //::exit(1); >} > >// Set global fxapp to SDK >res = ::SetFXApp(app); >// Cut heret to keep clean >} > >I will always get an error that I try to create a Window before parent >window was created. >I do not understand this behavior because it is always possible to >create a MessageBox on the Desktop handle. Iam not happy with the fact >that I cannot stop the app without tell the user why the app cannot >start. >Is there a workaround? I'm not sure what you're trying to do, or why. The basic sequence of events is to (1) construct the widgets, and then (2) create() them, *after* the constructor has finished. Parent widgets call create() on their children, so a single call to the top-window (like FXDialogBox) will suffice. Often, other resources such as images and icons are created in a overridden version of your dialog's create implementation [this is needed only if these resources are not "reachable" from the widgets. For example, if you have an FXLabel with an icon, the icon will be create()-ed as part of the FXLabel::create(). If there is another icon you want to replace this icon with, the icon isn't known to FXLabel and thus you should call create() on it somewhere else. W.r.t. FXMessageBox, its a top-level widget. Its parent is therefore the root window. But it may have an "owner" widget, which means it as a stacking-order trying to keep the FXMessageBox on top of its owner. With no owner, an FXMessageBox may be stacked above, or below, your window, and possibly not be seen unless user changes stacking order. -- JVZ -- +----------------------------------------------------------------------------+ | Copyright (C) 10:30 04/23/2022 Jeroen van der Zijp. All Rights Reserved. | +----------------------------------------------------------------------------+