# FXRuby multiple applications

**URL:** <https://www.ruby-forum.com/t/fxruby-multiple-applications/78414>\
**Category:** Ruby\
**Created:** [March 8, 2006, 2:05pm UTC](https://www.ruby-forum.com/t/fxruby-multiple-applications/78414 "2006-03-08T14:05:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 8, 2006, 2:05pm UTC](https://www.ruby-forum.com/t/fxruby-multiple-applications/78414/1 "2006-03-08T14:05:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 8, 2006, 2:45pm UTC](https://www.ruby-forum.com/t/fxruby-multiple-applications/78414/2 "2006-03-08T14:45:05Z")

</div>

start the scripts twice, or use a second window.

removed\_email\_address@domain.invalid schrieb:

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 8, 2006, 4:50pm UTC](https://www.ruby-forum.com/t/fxruby-multiple-applications/78414/3 "2006-03-08T16:50:35Z")

</div>

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 ☹

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 8, 2006, 8:07pm UTC](https://www.ruby-forum.com/t/fxruby-multiple-applications/78414/4 "2006-03-08T20:07:27Z")

</div>

On 3/8/06, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto: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?

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 9, 2006, 1:43pm UTC](https://www.ruby-forum.com/t/fxruby-multiple-applications/78414/5 "2006-03-09T13:43:58Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 8, 2006, 11:29pm UTC](https://www.ruby-forum.com/t/fxruby-multiple-applications/78414/6 "2006-03-08T23:29:14Z")

</div>

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
