Jan 14, 2008
Generic-user-small Thomas Wiecz... 5 posts

Topic: FXRuby / Layout problems with FXSwitcher

Great, I just read about recalc() on the FXRuby hompage. Great site! I’ll try it.

 
Jan 13, 2008
Generic-user-small Thomas Wiecz... 5 posts

Topic: FXRuby / Layout problems with FXSwitcher

I finished chapter 5.4 and I run into a strange problem which I cannot fathom out on my own.
My code looks more or less like the sample code for 5.4 and I run into a problem with it(I also replaced my code with the online version, but it is the same).
My first album, created in PictureBook#initialize() is in the AlbumListView. I import some photos and they are arranged according to the window width. I add a new album, click on it and import some photos there. But the picture are not arranged, there’s just one column with the pictures. If I click on my first album and then again on the new one, AlbumView.layout probably kicks in and the pictures are arranged as they should.
I have the same problem when I am in an album and maximize it. The photos are not rearranged until I click on a different album and then back to the old one.

Did someone experience the same behaviour?

Regards, Thomas

 
Jan 12, 2008
Generic-user-small Thomas Wiecz... 5 posts

Topic: FXRuby / Problem with understanding the PhotoView class

It’s a great book and I like how you go through the iterations.

IMHO it is more readable, when I add self to attributes which belong to the current class. I learned the hard way in Java that it is not much more to write to add this, but it keeps the code clearer for later reviews.

 
Jan 11, 2008
Generic-user-small Thomas Wiecz... 5 posts

Topic: FXRuby / Problem with understanding the PhotoView class

All right, I get it!
app is an instance variable of the superclass. You could also write self.app instead.

Sorry for the ruckus

 
Jan 11, 2008
Generic-user-small Thomas Wiecz... 5 posts

Topic: FXRuby / Problem with understanding the PhotoView class

I finished the third chapter and I am right now starting the fourth, but I don’t get one thing. Where does the PhotoView class gets its knowlegde of the app instance(page 33, pdf)?
Here’s the code:

class PhotoView < FXImageFrame

    def initialize(p, photo)
        super(p, nil)
        load_image(photo.path)
    end

    def load_image(path)    
        File.open(path, "rb") do |file|
            # I don't get it why "app" works!
            self.image = FXJPGImage.new(app, file.read)
        end
    end
end

app is only defined in the PictureBook class. How come that it works?

5 posts