[fxruby-users] composite widgets

lyle at knology.net lyle at knology.net
Thu May 12 11:37:33 EDT 2005

On Thu, 12 May 2005 09:25:03 -0600, Jacob Hanson <jacdx at jacobhanson.com> wrote :

> If I leave .create in, I get a segfault. Is there some sort of
> flag that tells me that .create has already been run?

Yes. You can call created? on a widget (or any object whose class is derived
from FXId) to determine whether it's been created yet. So something like
this should work:

    def addLabel(text)
      FXLabel.new(self, text) do |label|
        label.create if created?

As it sounds like you've discovered, your program will definitely crash if
you call create() on a child widget (such as a label added in addLabel)
before you've called create() on the parent widget.

More information about the fxruby-users mailing list