[fxruby-users] Showing a window, closing it, showing it again - error

Meinrad Recheis meinrad.recheis at gmail.com
Fri Jun 9 15:35:19 EDT 2006


On 6/9/06, Axel Etzold <AEtzold at gmx.de> wrote:
> Dear all,
>
> in a GUI, I have a help window with some text and a
> Menu toolbar button quite similar to that of textedit.rb:
> a help window of class FXDialog appears, displays a
> help text, and if you don't need it anymore, there is
> a button to close it. This works :)
> But when the user wants to see the help window again,
> and re-presses the menubar help button, the whole
> program exits saying:
>
>
> c:/axelhome/ngui/f30.rb:686:in `show': This FXDialogBox * already released (RuntimeError)
>         from c:/axelhome/ngui/f30.rb:686:in `onCmdShowHelp'
>         from c:/axelhome/ngui/f30.rb:893:in `runme'
>         from c:/axelhome/ngui/f30.rb:902
>
> This is the function I used :
>
> class MainWindow
>
>  def initialize
>     ...
>     # Help window
>
>     # init HelpWindow as in helpwindow.rb required by textedit.rb
>     @helpwindow = HelpWindow.new(self)
>  end
>  # Show help window
>   def onCmdShowHelp(sender, sel, ptr)
>     @helpwindow.show(PLACEMENT_CURSOR)  # line that generated the error.
>     return 1
>   end
> end
>
> How can I make help re-accessible ? In textedit.rb this works,
> but I don't know why.
>
> Thank you,
>
> Best regards,
>
> Axel

axel,

there are two ways to do it:
1) not destroying the window just hiding it.
2) calling create everytime you want to show it again.
hth,
-- henon


More information about the fxruby-users mailing list