[fxruby-users] FXFont bug

Lyle Johnson lyle at lylejohnson.name
Sat Nov 15 10:42:35 EST 2008


On Nov 15, 2008, at 6:01 AM, William Blum wrote:

> By trial and error I think I have figured out that if you assign a  
> font to a
> widget outside the parent's initialize method, you have to call  
> create on it
> first.
>
> Where is the best documentation that explains under what conditions  
> you must
> call create?

This topic is discussed in depth in section 7.7 of the FXRuby book  
("Client-Side vs. Server-Side Objects"). It's also discussed in this  
question from the FOX FAQ:

	http://www.fox-toolkit.org/faq.html#ILLEGALICON


> Is it a good idea to just call create under all circumstances?

Not necessarily; you can't, for example, call create() on an FXFont  
instance until its parent FXApp has been created. But yes, assuming  
that has already happened, you should probably call create() on the  
font as soon as you construct it, e.g.

	font = FXFont.new(...)
	font.create

Also, calling create() more than once on the same FXFont object is  
harmless; every call to create() after the first one is just a no-op.

> FXRI does not even mention a create method for FXFont.

I don't have FXRi installed on the computer I'm sitting at right now,  
but it may be the case that it doesn't show create() as a method on  
the FXFont class since it is actually declared in FXId, the base class  
for FXFont.

Hope this helps,

Lyle


More information about the fxruby-users mailing list