Screen splash

Hi:

how can i make an screen splash to see before application was open??

It´s important for me beacuse i need put a company logo. It´s something
like institutional, nor functional.

pd: I am using libglade.

Regards.

how can i make an screen splash to see before application was open??

It´s important for me beacuse i need put a company logo. It´s something
like institutional, nor functional.

pd: I am using libglade.

Hi,

Please define “before”. Until ruby & gtk is loaded, you cannot do such
thing. But then it’s just a window with an image.

Hi:

I have found a PHP GTK sample here:

this is my ruby version.

It works fine but the callback doesnt´s work. Any help?
Someone know like conect a signal inside a class:

class One
def initialize(callback)
callback
end

end

class Main
def initialize
One.new(“talk_with_me”)
end

def talk_with_me
puts “i am here”
end

end

GTK version by now:


require ‘gtk2’

class SplashScreen < Gtk::Window

def initialize(img_dir,callback)
super(Gtk::Window::POPUP)
self.window_position=Gtk::Window::POS_CENTER
vbox=Gtk::VBox.new
img=Gtk::Image.new(img_dir)
vbox.pack_start(img,false,false)
self.add(vbox)
self.show_all
Gtk.timeout_add(100) {
callback
}
end

def hide
self.hide
end
end

class Application

def initialize
@splash=SplashScreen.new(“screen.png”,“end_splash”)

end

def end_splash
@splash.hide
puts “i am not here!!!”
end
end

Application.new

Gtk.main

Hi:

Hi,

Please define “before”. Until ruby & gtk is loaded, you cannot do such
thing. But then it’s just a window with an image.

I know, i don´t need create a screen splash professional and real. The
most important is the company logo, because the software is a fake :smiley: .
it´s only for publicity.

thanks.

thanks joaz:

this is my final version of the fake:
I have added a timeout remove because create infinite windows, and i
have added a time parameter to be configurable.

require ‘gtk2’

class SplashScreen < Gtk::Window

def initialize(img_dir,time,&callback)
super(Gtk::Window::POPUP)
self.window_position=Gtk::Window::POS_CENTER
vbox=Gtk::VBox.new
img=Gtk::Image.new(img_dir)
vbox.pack_start(img,false,false)
self.add(vbox)
self.show_all
@id_timeout=Gtk.timeout_add(time) {
callback.call
}
end

def hide_splash
self.hide
Gtk.timeout_remove(@id_timeout)

end
end

class Application

def initialize
@splash=SplashScreen.new(“screen.png”,1000){
end_splash
}

end

def end_splash
@splash.hide_splash
@window=Gtk::Window.new
@window.signal_connect(“destroy”) { Gtk.main_quit }
@window.window_position=Gtk::Window::POS_CENTER
@window.show_all
end
end

Application.new

Gtk.main

It works fine but the callback doesnt´s work. Any help?
Someone know like conect a signal inside a class:
Sure it doesn’t work like. You’re giving a string parameter to the
Splashscreen class. You can’t expect a String to call a function :slight_smile:

Try using blocks:

def initialize(img_dir,&callback)
[…]
Gtk.timeout_add(100) {
callback.call
}
end

And then
@splash=SplashScreen.new(“screen.png”){
end_splash
}

Application.new

Gtk.main

this part is probably dangerous. your Application object is normally
reclaimable by the garbage collector, as you hold no references on it
when you trigger Gtk.main.


Guillaume C. - http://zarb.org/~gc/

Guillaume C. wrote:

Application.new

Gtk.main

this part is probably dangerous. your Application object is normally
reclaimable by the garbage collector, as you hold no references on it
when you trigger Gtk.main.


Guillaume C. - http://zarb.org/~gc/

Thanks Guillaume. I don´t know the garbage collector system in ruby.

What is it a better solution then??

On Mon, Apr 21, 2008 at 5:55 PM, Martin V.
[email protected] wrote:


Guillaume C. - http://zarb.org/~gc/

Thanks Guillaume. I don´t know the garbage collector system in ruby.

What is it a better solution then??

You just need to retain a reference on your object. As the application
is global to the program, I find the use of global variables logical,
so I can do like:

$app = Application.new


Guillaume C. - http://zarb.org/~gc/

Am Montag, den 21.04.2008, 12:47 +0200 schrieb Martin V.:

super(Gtk::Window::POPUP)

Popups are only intended for things like menus or tooltips.

Better use

your_window.decorated = false

Cheers, detlef

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs