[fxruby-users] No more GUI update after FXRuby app put in the background?

Philippe Lang philippe.lang at attiksystem.ch
Tue Jan 13 03:39:19 EST 2009


Hi,

Here is a small program that represents the GUI I use for deploying
FXRuby applications: a small window, with a progress bar in it.

It works fine, as long as the application is not put in the background.
Then the GUI stops being updated, even if the application is put back to
the foreground again.

Is there anything I can do for this?

Thanks,

Philippe Lang

Note: Windows XP, ruby 1.8.6, FXRuby 1.6.18

-------------------------------
#!/usr/bin/ruby

require 'fox16'

include Fox

class MyWindow < FXMainWindow
    def initialize(app, title, icon=nil, miniIcon=nil, opts=DECOR_ALL,
x=0, y=0, width=0, height=0, padLeft=0, padRight=0, padTop=0,
padBottom=0, hSpacing=4, vSpacing=4)
        super
        @bar = FXProgressBar.new(self, nil, 0,
PROGRESSBAR_PERCENTAGE|LAYOUT_FILL_X)
        @label = FXLabel.new(self, "")
    end

    def deploy
        setTotal(100)
        setProgress(0, "Step 0")
        sleep 1
        setProgress(10, "Step 1")
        sleep 1
        setProgress(20, "Step 2")
        sleep 1
        setProgress(30, "Step 3")
        sleep 1
        setProgress(40, "Step 4")
        sleep 1
        setProgress(50, "Step 5")
        sleep 1
        setProgress(60, "Step 6")
        sleep 1
        setProgress(70, "Step 7")
        sleep 1
        setProgress(80, "Step 8")
        sleep 1
        setProgress(90, "Step 9")
        sleep 1
        setProgress(100, "Step 10")
    end
    
    def setTotal(progress_total)
        @bar.total = progress_total
    end
    
    def setProgress(progress_value, progress_text)
        @bar.progress = progress_value
        @label.text = progress_text
        
        # Let's try all the armada of refresh-redraw-repaint-everything
NOW.
        update
        recalc
        layout
        repaint
        $app.forceRefresh
    end
end

class MyApp < FXApp
    def initialize(appName="Application", vendorName="FoxDefault")
        super
        @window = MyWindow.new(self, "Deployment", nil, nil, DECOR_ALL,
0, 0, 300, 40)
    end
    
    def create
        begin
            super
            @window.show(PLACEMENT_SCREEN)
            @window.deploy
            @window.close
        rescue Exception => e
            
        end
    end
end

# Main program
GC.disable            # Does not help
$app = MyApp.new()
$app.disableThreads   # Does not help
$app.create
-------------------------------



More information about the fxruby-users mailing list