Re: Programmatically constructing ...

Michael Flanagan <[email protected]> Thu, 25 Sep 2003 17:33:51 -0700
Newsgroups gmane.comp.windows.devel.netwindows
Message-ID <[email protected]>
Christian Boulanger wrote:

> I am still clueless as to how to programmatically construct tabbed panes. I
> tried the following:
> 
> tabbed_pane = new NW_WIDGET_tabbed_pane(right_pane,"100%","100%");
> var startTab = new NW_WIDGET_tab_ds("Introduction", "start.html");
> startTab.getFromURL();
> tabbed_pane.createTab(startTab);
> var tabNode = document.createElement("div");
> var tabd = new NW_WIDGET_tab_ds("name", null, tabNode);
> tabbed_pane.addTab(tabd);
> 
> But this did not work. Any hints?
> 
> Christian 

I never tried doing this programatically but maybe try somthing along 
the lines of:

/**
  * Use the factory function to create a new tabbed_pane widget. It
  * expects the parameters (width, height) which I believe is in pixels.
  */
var my_tabbed_pane = NW_WIDGET_FACTORY_tabbed_pane("500","300");

// Create your tabs. Use the following if you have an external page
var external_tab = new NW_WIDGET_tab_ds("Introduction", "start.html")

// The tab has the logic to retrieve the content itself, you just need
// to tell it to do so by calling getFromURL(). As a result...
external_tab.getFromURL();

// If the content already exists in a <div> tag, do the following
var internal_tab = new NW_WIDGET_tab_ds("Introduction", null, 
document.getElementById("myContentDiv"));

/**
  * The tabbed_pane has an add() method that expects an instance of
  * NW_WIDGET_tab_ds. Use it to add new pane instances to your instance
  * of the tabbed_pane widget.
  */
my_tabbed_pane.add(external_tab);
my_tabbed_pane.add(internal_tab);

Anyway, that _should_ work for you. If not, reply back to the list.

Cheers,
Michael

ps. Don't forget, Venkman is your friend!


_______________________________________________
The netWindows developers list: [email protected]
http://netwindows.org/mailman/listinfo/devel_netwindows.org