[fxruby] create children

I want to add some widgets outside the constructor.
I have been looking at freeride how they do it (they
use widget.create all the time). So I made this
piece of code which works fine. But…

dummy = FXTabItem.new(@tabbook, “Dummy”, nil)
dummy.create
frame = FXVerticalFrame.new(@tabbook, FRAME_THICK|FRAME_RAISED)
frame.create
@tabbook.recalc
@tabbook.forceRefresh

I have many widgets which needs to be created…
can I avoid calling create…

Is there some way to automaticaly create all childrend ??
Or do I have to do it manually myself ?

You can see my code here:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/sysinstall2/project_sysinstall2/frontend_fox/main_window.rb?rev=1.3.2.3&only_with_tag=repaint_added_widgets&content-type=text/vnd.viewcvs-markup

···


Simon Strandgaard

I found out myself… well inheriting from FXHorizontalFrame
does the job…

Problem is solved :slight_smile:

···

On Tue, 06 May 2003 15:12:35 +0200, Simon Strandgaard wrote:

I have many widgets which needs to be created…
can I avoid calling create…

Is there some way to automaticaly create all childrend ??
Or do I have to do it manually myself ?

Simon Strandgaard wrote:

Is there some way to automaticaly create all children?

When you call create() on an FXComposite widget (such as FXTabBook) it
should recursively create() on all of its as-yet-uncreated child
widgets, i.e.

 # Construct some new objects
 FXTabItem.new(@tabbook, "Dummy", nil)
 FXVerticalFrame.new(@tabbook, FRAME_THICK|FRAME_RAISED)

 # Calls create on both the new tab item and the new vertical frame
 @tabbook.create

There is no harm in calling create() on a widget more than once.

Thanks :slight_smile:

If anyone wants to see how I did it

see line 29-46:

see line 1-3:

···

On Tue, 06 May 2003 12:01:52 +0000, Lyle Johnson wrote:

Simon Strandgaard wrote:

Is there some way to automaticaly create all children?

When you call create() on an FXComposite widget (such as FXTabBook) it
should recursively create() on all of its as-yet-uncreated child
widgets, i.e.

 # Construct some new objects
 FXTabItem.new(@tabbook, "Dummy", nil)
 FXVerticalFrame.new(@tabbook, FRAME_THICK|FRAME_RAISED)

 # Calls create on both the new tab item and the new vertical frame
 @tabbook.create

There is no harm in calling create() on a widget more than once.