[fxruby-users] What ever have I done wrong now?

Lyle Johnson lyle at lylejohnson.name
Wed May 21 11:31:32 EDT 2008

On May 21, 2008, at 10:17 AM, David Toll wrote:

> I wrote a simple program, to do further experiments with tables.
> However, before I even started on my experiments, it went wrong.
> If you run this, it displays a simple table.
> If you look at the source, you can see that the calls to  
> "fitColumnsToContents" and "fitRowsToContents" are both commented  
> out.  Note that the "fitColumnsToContents" is the replacement  
> version you wrote a few days ago.
> If I un-comment either of these, then the table columns or rows  
> (respectively) are shrunk bigtime.  There is a printf in  
> "fitColumnsToContents" to display the cw and hw values - these  
> clearly are garbage (far too small).
> What ever have I done wrong here?

The problem is that at the time you're calling fitColumnsToContents(),  
the fonts haven't been created yet. I can't seem to get to the FOX  
home page at the moment, but if I could, I'd point you to an item in  
the FAQ there that talks about this issue of created versus non- 
created fonts (or icons, etc.) There's also some discussion of it in  
section 7.7 of the book, where I talk about client-side versus server- 
side objects.

If you just move those two calls to your create() method, e.g.

	def create

You should get the desired result.

Hope this helps,


"FXRuby: Create Lean and Mean GUIs with Ruby"
Now available from the Pragmatic Bookshelf!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20080521/8e9600b4/attachment.html>

More information about the fxruby-users mailing list