[fxruby-users] FXSplitter width is 1 until created

Joel VanderWerf vjoel at path.berkeley.edu
Thu Apr 26 19:22:29 EDT 2007


Joel VanderWerf wrote:
...
> So I'll stick with configuring it in #create.

Btw, ruby closures are a very clean way to do this.

   def on_create(&block)
     @create_actions ||= []
     @create_actions << block
   end

   def do_create_actions
     @create_actions and @create_actions.each do |action|
       action.call
     end
   end

   def initialize(*)
     splitter = ...
     on_create do # <-- this is all I had to change in initialize
       # configure the splitter based on its width and the preferences
       # for split proportion
     end
   end

   def create
     super
     do_create_actions
     show
   end

Ok, that's enough noise for a while.

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407


More information about the fxruby-users mailing list