Hey all,

For those of you who want to use Wt to handle only part(s) of a an
existing web page, we now also support the so-called "WidgetSet"
deployment mode.

The main way of embedding a Wt application in an existing web page is like this:

...
<body>

  <div id="panel1"></div>
  <div id="panel2"></div>

  <script src="/myapp.wt?div1=panel1&amp;div2=panel2"></script>

</body>
...

This will start your application, and it passes two parameters (div1
and div2) which may be bound in the application as a top-level widget
(a div could corerspond to a WContainerWidget). A single application
can manage any number of top-level elements, and you are free to use a
convention for the element id's or pass them as parameters (as in this
case).

In the application you would have some code that does this:

...
WApplication *myApp = ...

WContainerWidget *panel1 = new WContainerWidget();
WContainerWidget *panel2 = new WContainerWidget();

myApp->bindWidget(panel1, myApp->environment().getArgument("div1")[0]);
myApp->bindWidget(panel2, myApp->environment().getArgument("div2")[0]);

// use panel1 and panel2 as two top-level widgets instead of myApp->root()
...

We added a new example (hello-widgetset) that demonstrates this.

What would be a nice addition in the future, is to allow the
definition of a JavaScript API for your application which would
provide a simple way to call C++ methods from JavaScript (and
JavaScript call-backs from C++). This is a bit similar to how we now
have support for JSignal<> and Wt.emit(), but it would be for more
more general.

Regards,
koen

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to