On Dec 16, 2003, at 7:52 PM, Joel VanderWerf wrote:
> I just realized how easy this is to do, so here is for posterity
> (i.e., so I can google it when I forget how to do it :) The trick is
> to avoid app.run (which would never terminate by itself because
> win.show never happened, so there's nothing to close). Apologies if
> this is common knowledge...
>
> require 'fox'
> include Fox
>
> app = FXApp.new
> win = FXMainWindow.new(app, "")
>
> app.create
>
> FXMessageBox.error(win, MBOX_OK, "caption", "message")
Thanks for sharing this, Joel. It's also perhaps worth pointing out
that this approach works for the more general case of just popping up
any kind of dialog box. For example, to show a file dialog:
require 'fox'
include Fox
FXApp.new do |anApp|
FXMainWindow.new(anApp, "") do |theMainWindow|
anApp.create
puts FXFileDialog.getOpenFilename(theMainWindow, "Pick a file, any
file", Dir.getwd)
end
end
Lyle
|