# FXSplashWindow usage question

**URL:** <https://www.ruby-forum.com/t/fxsplashwindow-usage-question/102834>\
**Category:** Ruby\
**Created:** [February 7, 2006, 10:09am UTC](https://www.ruby-forum.com/t/fxsplashwindow-usage-question/102834 "2006-02-07T10:09:06Z")\
**Posts on this page:** 2\
**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:** [February 7, 2006, 10:09am UTC](https://www.ruby-forum.com/t/fxsplashwindow-usage-question/102834/1 "2006-02-07T10:09:06Z")

</div>

Dear lopex, dear all,

thank you for suggesting FXSplashWindow.  
Unfortunately, I have not been able to use it so far –  
these are my very first steps in FXRuby (not in Ruby, though).  
The code below is combined from the “hello.rb” code from the FXRuby  
tutorial  
and from the FXSplashWindow.rb file.  
It only shows the Hello-world Window, but not the SplashScreen.  
What am I missing ?

Thank you,  
Axel

* * *

require “fox14”

include Fox

module Fox

# 

# The Splash Window is a window typically shown during startup

# of an application. It comprises a large icon, which is also

# used as the shape of the window if +SPLASH\_SHAPED+ is passed;

# with the +SPLASH\_SIMPLE+ option the window will be simply

rectangular.

# 

# === Splash window options

# 

# +SPLASH\_SIMPLE+:: Simple rectangular splash window

# +SPLASH\_SHAPED+:: Shaped splash window

# +SPLASH\_OWNS\_ICON+:: Splash window will own the icon and destroy it

# +SPLASH\_DESTROY+:: Splash window will destroy itself when timer

expires

# 

class FXSplashWindow \< FXTopWindow

# The splash window’s icon [FXIcon]

attr\_accessor :icon

# The delay before hiding the splash window, in milliseconds [Integer]

attr\_accessor :delay

```
# Construct splash window

```

def initialize(app, ic, opts=SPLASH\_SIMPLE, ms=5000) # :yields:  
theSplashWindow  
end

```
# Construct splash window

```

def initialize(ow, ic, opts=SPLASH\_SIMPLE, ms=5000) # :yields:  
theSplashWindow  
end  
end  
end

application = FXApp.new(“Hello”, “FoxTest”)  
app = FXSplashWindow.new(application,‘sc30.png’,opts=SPLASH\_SIMPLE,  
ms=5000)

main = FXMainWindow.new(application, “Hello”, nil, nil, DECOR\_ALL)  
FXButton.new(main, “&Hello, World!”, nil, application, FXApp::ID\_QUIT)  
application.create()  
main.show(PLACEMENT\_SCREEN)  
application.run()

---

<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:** [February 7, 2006, 12:45pm UTC](https://www.ruby-forum.com/t/fxsplashwindow-usage-question/102834/2 "2006-02-07T12:45:51Z")

</div>

According to solution 1 found at:  
[http://www.fox-toolkit.net/cgi-bin/wiki.pl?Tutorial\_13\_SplashScreen](http://www.fox-toolkit.net/cgi-bin/wiki.pl?Tutorial_13_SplashScreen)

require “fox14”  
include Fox

app=FXApp.new(“Hello”, “FoxTest”)

ico=FXPNGIcon.new(app,open(“splash.png”,“rb”).read)  
splash=FXSplashWindow.new(app,ico,SPLASH\_SIMPLE,5000)

app.create()  
splash.show(PLACEMENT\_SCREEN)  
app.runModalWhileShown(splash);

main=FXMainWindow.new(app, “Hello”, nil, nil, DECOR\_ALL)  
FXButton.new(main, “&Hello, World!”, nil, app, FXApp::ID\_QUIT)

main.create  
main.show(PLACEMENT\_SCREEN)

app.run

lopex
