https://bugzilla.novell.com/show_bug.cgi?id=359523
User sh@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=359523#c1
Stefan Hundhammer changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sh@novell.com
--- Comment #1 from Stefan Hundhammer 2008-06-13 08:19:06 MDT ---
Open windows that should really be no longer open are bugs in the calling
application. Always. Those bugs need to be fixed in the proper places, not with
some magic call like "no matter what is open now, close everything until this
dialog is the topmost" magic.
Such a UI built-in is utterly evil. It will break a lot more stuff than it
could possibly ever fix.
And I know very well who would get the bug reports we'd inevitably get and
debug the resulting disaster. Hint: It's not you.
If you'd like to check if the dialog you try to access is really the one you
mean (which is what your suggested built-in would make sure - but with brute
force, by killing other (possibly important) dialogs), you can always give some
widget a specific ID (hint: all widgets can get IDs, even VBox(), HBox(), etc.)
and query for a widget with that ID with UI::WidgetExists(). That call will
only return 'true' if a widget with that ID exists in the current dialog.
Still, it is utterly wrong to close somebody else's dialogs. That somebody else
has to take care of his own dialogs.
For each UI::OpenDialog(), there must be a UI::UserInput(), UI::WaitForEvent()
or UI::PollInput() that reacts to the button that is supposed to close that
dialog ("OK", "Close", or whatever). It is the task of that event handler to
call the corresponding UI::CloseDialog().
If that cannot be guaranteed reliably (e.g. because it's a UI::PollInput()
called from somewhere in the package callbacks), that's technically a design
bug.
A workaround for such a design bug would be some clean-up code like this:
UI::OpenDialog(`VBox(`id(`pkg_popup),
`Label( _( "...bla..." ),
`PushButton(`id(`ok)
);
..
any widgetId = UI::PollInput();
if ( widgetId == `ok || widgetId == `cancel )
UI::CloseDialog();
// later, when the pkg stuff is guaranteed to be over
if ( UI::WidgetExists(`pkg_popup) )
UI::CloseDialog(); // close leftover popup from package callbacks
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.