# Wx::SplashScreen, and events

**URL:** <https://www.ruby-forum.com/t/wx-splashscreen-and-events/124272>\
**Category:** wxRuby\
**Created:** [December 27, 2007, 8:23am UTC](https://www.ruby-forum.com/t/wx-splashscreen-and-events/124272 "2007-12-27T08:23:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EchoB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/45deac/32.png) [@EchoB](https://www.ruby-forum.com/u/EchoB)\
**Post date:** [December 27, 2007, 8:23am UTC](https://www.ruby-forum.com/t/wx-splashscreen-and-events/124272/1 "2007-12-27T08:23:02Z")

</div>

I have the following code:  
#time = 7000

class TimeSplash \< Wx::SplashScreen  
PATH\_MAIN = 1  
PATH\_SETUP = 0  
def initialize(time, path=PATH\_MAIN)  
splash\_bitmap = Wx::Bitmap.new(‘timefly.png’, Wx::BITMAP\_TYPE\_PNG)  
super(splash\_bitmap,  
Wx::SPLASH\_CENTRE\_ON\_SCREEN|Wx::SPLASH\_TIMEOUT, time, nil, -1)  
evt\_close() {|evt| on\_close\_window(evt, path)}  
end

# def on\_close\_window(evt, path) if path == PATH\_MAIN print “main app!” elsif path == PATH\_SETUP print “setup!” end self.destroy() end end

Now I’m stuck - If I click the splash screen while it is being displayed  
it calls the evt\_close() event and prints a message. However - if I wait  
for it to timeout - it fades away and then nothing happens. What event  
is triggered at the timeout? How can I trap it? Where are these events  
documented? 🙂

---

<div class="post-metadata">

**Author:** ![EchoB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/45deac/32.png) [@EchoB](https://www.ruby-forum.com/u/EchoB)\
**Post date:** [December 27, 2007, 3:52pm UTC](https://www.ruby-forum.com/t/wx-splashscreen-and-events/124272/2 "2007-12-27T15:52:04Z")

</div>

EchoB wrote:

> Now I’m stuck - If I click the splash screen while it is being displayed  
> it calls the evt\_close() event and prints a message. However - if I wait  
> for it to timeout - it fades away and then nothing happens. What event  
> is triggered at the timeout? How can I trap it?  
> I don’t know how you can. But I don’t know why you would?

Code execution continues after the call to SplashScreen.new, allowing  
you to do time-consuming initialisation while the splash is visible and  
entertaining the user. Once the initialisation is done you can let the  
Splash timeout, let the user close it, or explicitly close it yourself  
using a standard close call.

> Where are these events  
> documented? 🙂  
> In a slightly scattered way: per-control event hooks (eg TreeEvent,  
> CommandEvent, GridEvent) are listed with the control; non-command GUI  
> event hooks (eg MenuEvent, SizeEvent, CloseEvent) are listed in the  
> event class. The comprehensive list is very long (see  
> lib/wx/classes/evthandler.rb for a full alphabetic list), but hte list  
> of Event classes in the doc homepage is not a bad place to start.

alex
