[fxruby-users] FXMDIChild shrinkwrap to content

Joel VanderWerf vjoel at path.berkeley.edu
Sun May 20 19:17:45 EDT 2007


Lyle Johnson wrote:
> On 5/17/07, Joel VanderWerf <vjoel at path.berkeley.edu> wrote:
> 
>> How can I get a FXMDIChild to shrinkwrap to its content?
>>
>> Here's what I'm doing now:
>>
>>    def create(*)
>>      self.height = maxChildHeight + 30
>>      self.width = maxChildWidth + 10
>>      super
>>    end
>>
>> This works, but I'm not crazy about manually adjusting for (apparently)
>> frame and title bar sizes.
> 
> This is only marginally better, but I think you could instead do:
> 
>     self.height = defaultHeight + maxChildHeight
>     self.width = defaultWidth + maxChildWidth
> 
> The defaultHeight and defaultWidth return values should take care of
> the dimensions of the window's decorations (title bar, etc.)
> 
> Hope this helps,

Hm, that seems to make the window too big. Doesn't defaultWidth count 
the (minimum?) width of the children? So, it seems like part of the 
child windows are being counted twice...

That might still be a good idea, though. Maybe I could call 
defaultWidth/defaultHeight before adding child windows, and save that 
away somewhere... nope. defaultWidth always seems to be too big.

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


More information about the fxruby-users mailing list