Hello!
You forgot to add valid template text.
Please, read description and example here:
http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WTemplate.html
First argument of bindWidget() is a key, which should be represented
in template text as ${key}.
In your case, it can be fixed like this:
WTemplate * wtmplate = new WTemplate(
"Template <br/> Two: ${two} <br/> Three: ${three}");
wtmplate->bindWidget( "two", new WText( "two"));
wtmplate->bindWidget( "three", new WText( "three"));
On Mon, Apr 1, 2013 at 4:51 AM, Jim Frederick <[email protected]> wrote:
> I'm trying to use WTemplate so that I can use CSS rather than tables for
> layout. The example below is a simple attempt to use WTemplate based on
> sample code in the WTemplate docs, but the resulting web page only shows the
> template name. Are there examples of WTemplate I can refer to? Am I missing
> a step to make the bound widgets visible? I've searched the Wt examples, and
> searched the internet for "Wt" "WTemplate" and didn't really find anything
> other than recommendations to use CSS rather than layout tools.
>
> /*constructor*/ TestApp(const Wt::WEnvironment& env):Wt::WApplication(env)
> {
>
> root()->addWidget( new WText( "one"));
>
> WTemplate * wtmplate = new WTemplate("Template");
> wtmplate->bindWidget( "Two:", new WText( "two"));
> wtmplate->bindWidget( "Three:", new WText( "three"));
>
> root()->addWidget( wtmplate );
> // html has: <div id="ommuiys">Template</div> but no bound widgets.
>
> root()->addWidget( new WText( "four"));
>
> // Browser shows:
> // one
> // Template
> // four
>
> }
>
>
> ------------------------------------------------------------------------------
> Own the Future-Intel® Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game
> on Steam. $5K grand prize plus 10 genre and skill prizes.
> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
------------------------------------------------------------------------------
Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game
on Steam. $5K grand prize plus 10 genre and skill prizes.
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest