Mixing Widgets into an HTML Page

Revision as of 01:47, 20 April 2006 by IamPersistent (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


  <h1>Menu Test</h1>

  <div id="menu_bar">
    & nbsp;
  </div> <!-- menu_bar -->

Set up the Shell

Must set to virtual

 var shell = new DwtShell("MainShell", true, null, null, true);

Putting a Widget in a <div>

To put a Dwt widget in a <div> , you need to get the document element of the <div> , clear the contents and then reparent the Dwt widget in the element. Here is an example of how to do that.

  // create a toolbar
  var toolbar = new DwtToolBar(parent, "mainMenu", DwtControl.ABSOLUTE_STYLE, 2);

    ... Here we would have the code to add buttons to the toolbar 

  // Get the div into which we want to place the toolbar
  var div = document.getElementById("menu_bar");

  // Clean out any content
  div.innerHTML = "";

  // Reparent the toolbar's HTML element to the div
Jump to: navigation, search