[fxruby-users] Add a tab to a tabbok dynamically?
Lyle Johnson
lyle at knology.net
Tue Oct 3 08:48:41 EDT 2006
On Oct 3, 2006, at 5:52 AM, Philippe Lang wrote:
> I cannot figure out how to add a tab to a tabbook dynamically,
> while the program is running.
>
> Does anyone know how to force the tab to appear? I tried calling
> recalc, repaint, layout or forceRefresh, but no success... Below is
> a small example.
<snip>
> def onAddTab(sender, sel, data)
> puts "A tab is added..."
> FXTabItem.new(@tabbook, "Another tab", nil)
> FXVerticalFrame.new(@tabbook,
> LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_RAISED)
>
> self.recalc
> self.repaint
> self.layout
> self.forceRefresh
>
> @tabbook.recalc
> @tabbook.repaint
> @tabbook.layout
> @tabbook.forceRefresh
> end
You need to call create() on the new tab item and vertical frame.
Another way would be to call create() on their parent (@tabbook). You
don't need any of that other stuff (i.e. the calls to recalc,
repaint, layout and forceRefresh).
More information about the fxruby-users
mailing list