[fxruby-users] [Foxgui-users] Stopping a FOX popup window

Lyle Johnson lyle at lylejohnson.name
Wed Dec 5 13:14:02 EST 2007

On 12/5/07, Thomas, Jason M (Software) <jmthomas at ball.com> wrote:

> That worked great! I'm just curious why I was going down the wrong path.
> Was it because I called runPopup with a FXMainWindow?


> Does runPopup only work with a FXPopup?

Well, it's only meant to work with popups, but since it accepts an
FXWindow argument, you can (as you discovered) pass in any kind of
window. runPopup() is one of those methods that I think probably
shouldn't be public, because it's really sort of a special purpose
method that FOX only uses internally (as best I can tell). Maybe
Jeroen will interject with some words of wisdom on this point. ;)

> When should FXApp.stop be called?

stop() breaks out of all of the (possibly many) nested event loops, to
the very top one, which eventually causes your program to fall out of
the top-level run().

> I tried the following:
>   popup = FXPopup.new(window)
>   popup.popup(nil, 0, 0)
>   application.runPopup(popup)
> At this point the popup window appeared. Then in my other thread I did:
>   sleep(2)
>   app = FXApp.instance
>   app.stop
> This results in a Segmentation fault. Any ideas?

Well, I'm not really sure what it is that you're trying to do. For
example, I don't understand why you've fixated on popups (which are
primarily used for things like tooltips and menu panes). But since
runPopup() starts a modal event loop for the popup window, the way to
shut it down would be to either call stopModal(), or to just hide the
popup (as I showed earlier).

If you're wanting to display a little informational message to the
user, I think you want to take a look at FXMessageBox. Or maybe
FXDialogBox, if FXMessageBox doesn't quite give you all of the control
that you need.

> Thanks again for helping me. Right now I'm just trying to understand how
> FOX works.

No problem! We're all learning. ;)

More information about the fxruby-users mailing list