Skip to content

How can I open the same window twice #45

@murathptest

Description

@murathptest

Hi,
I am trying to use fxruby to open a FileDialog multiple times through out the execution of the main ruby program which is not a GUI program. The main program executes, then there is a need to open a directory to pick a file and submit. And then pick another file and submit, so it is in a loop.
I see the following error: attempted to create more than one FXApp instance (RuntimeError)

To simplify my question, I am copying the following code.
If a user wanted to reopen the Hello World box twice in the same program once the first box is closed by clicking on the red (x) of the windows (upper right corner), how would he restart it again in the same program. I tried .exit, .destroy with subsequent object recreations and that did not work.

require 'fox16'
include Fox

class HelloWorld < FXMainWindow
def initialize(app)
super(app, "Hello, World!" , :width => 200, :height => 50)
end
def create
super
show(PLACEMENT_SCREEN)
end
end

app = FXApp.new
HelloWorld.new(app)
app.create
app.run
app.exit
HelloWorld.new(app)
app.create
app.run

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions