[fxruby-users] Dynamic, resizeable frame content

Jannis Pohlmann info at sten-net.de
Thu Jun 16 20:23:30 EDT 2005


Hi all.

I have a class derived from FXHorizontalFrame which should be dynamic. This
means, it has to be able to add new children on runtime (not that 
difficult).
Basically, this works like:

class MyFrame < FXHorizontalFrame

    ...

    def addChild(foxobject)
       foxobject.reparent(self)
       recalc
    end

    def show
       super
       updateWidths
    end

end

The main problem is that I want to be able to resize the children 
without losing
their new size on the next window resize action. I have a method for that:

    def updateWidths
       # Get array of widths from another object
       widths = @table.getWidths
      
       for index in 0..(widths.size-1)
          begin
             child = childAtIndex(index)
             child.resize(widths[index], child.height)
             recalc
          end
       end
    end

Now, first thing is: The fucking children don't get resized. That's due 
to the fact
that the frame visibility is toggled via a keyboard shortcut:

    myFrameInstance.show

I read something about overloading getDefaultHeight and getDefaultWidth, 
yet I don't
know if that's necessary here.

Does anyone of you, kind readers, have an idea about it?

Thanks in advance,
Jannis


More information about the fxruby-users mailing list