Splashscreen showing progress

I’d like to use a splashscreen instead of a progress dialog. I have a
png that I can use with Bitmap.new, and I found that I can write text to
it, but is there any way for me to update that text once the
splashscreen is displayed?

    def splash
      bmp = Wx::Bitmap.new(SPLASH_IMG, Wx::BITMAP_TYPE_PNG)
      bmp.draw do |dc|
        dc.set_font(Wx::Font.new(8, Wx::FONTFAMILY_SWISS,
Wx::FONTSTYLE_NORMAL, Wx::FONTWEIGHT_LIGHT))
        dc.set_text_foreground(Wx::WHITE)
        dc.draw_text('Loading...', 20, 200)
      end
      ss  = Wx::SplashScreen.new(bmp,
Wx::SPLASH_CENTRE_ON_PARENT|Wx::SPLASH_TIMEOUT, 3000, nil, -1)
      # Is there any way to essentially "dc.draw_text(...)" at this
point?
      yield if block_given?
      ss.destroy
    end

El Gato wrote:

I’d like to use a splashscreen instead of a progress dialog. I have a
png that I can use with Bitmap.new, and I found that I can write text to
it, but is there any way for me to update that text once the
splashscreen is displayed?

I can’t see anything in the wxSplashScreen API, but I expect you could
do it by defining a subclass of SplashScreen with its own evt_paint
handler which just draws the bitmap, and then update it by calling
refresh() as required, which will call the paint routine.

alex

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