Forum: Ruby FXRuby multiple applications

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2006-03-08 15:05
(Received via mailing list)
i use FXRuby and try to start a applicattion twice with the following
code:

require  "fox12.so"
include Fox

def start_fox_app
  application = FXApp.new("FoxTest", "ruby")
  application.init(ARGV)
  window = FXMainWindow.new(application, "FOX", nil, nil, DECOR_ALL,
0, 0, 580, 500)
  window.show(PLACEMENT_SCREEN)
  application.create
  application.run
end

start_fox_app
start_fox_app

The second call of "start_fox_app" leads to a segmentation fault. The
same thing
also occurs if i try to differenet apps
Any ideas why this can happen and how to prevent this behavior?

hth, Michael
Gregor K. (Guest)
on 2006-03-08 15:45
(Received via mailing list)
start the scripts twice, or use a second window.


removed_email_address@domain.invalid schrieb:
unknown (Guest)
on 2006-03-08 17:50
(Received via mailing list)
the problem is that i want to embed to start_fox_app in c++.
so c++ opens a FXRuby GUI. starting the script twice (in the same c++
process)
does not solve the probelm :(
Lyle J. (Guest)
on 2006-03-08 21:07
(Received via mailing list)
On 3/8/06, removed_email_address@domain.invalid 
<removed_email_address@domain.invalid> wrote:

> i use FXRuby and try to start a applicattion twice with the following
> code:

Well, you can't have more than one application instance in the same
process, so that's a problem. What is it that you're trying to
accomplish? Do you want multiple main windows or something?
Vincenzo P. (Guest)
on 2006-03-09 00:29
(Received via mailing list)
removed_email_address@domain.invalid ha scritto:

>the problem is that i want to embed to start_fox_app in c++.
>so c++ opens a FXRuby GUI. starting the script twice (in the same c++
>process)
>does not solve the probelm :(
>
>
>
>
>
The following works, it opens two main windows ...

def create_window(application)
    window = FXMainWindow.new(application, "FOX", nil, nil, DECOR_ALL,0,
0, 580,    window.show(PLACEMENT_SCREEN)
end

def start_fox_app
    application = FXApp.new("FoxTest", "ruby")
    application.init(ARGV)
    create_window(application)
    create_window(application)
    application.create
    application.run
end

start_fox_app
unknown (Guest)
on 2006-03-09 14:43
(Received via mailing list)
I try to make a c++ application with a "open"-button allowing the user
to open an FXRuby window (to enrich the app with more interactivity).
If the window is closed (and the FXApp terminates) opening the same
window a second time via the "open"-button does not work.
So i want to restart the whole FXApp with one window. Another way would
be to make  the window invisible when user tries to close it and make
visible again on "open"-button press.
Is this possible? Any ideas how to this or another solutions?
This topic is locked and can not be replied to.