I have the following view class:

> #pragma once
>
> #include <Wt/WTemplate>
> #include <Wt/WString>
> #include <Wt/WContainerWidget>
>
> #include <string>
>
> class View : public Wt::WContainerWidget
> {
> private:
>     const std::string name;
> protected:
>     Wt::WTemplate *_template;
> public:
>     View(const std::string newName)
>     :    name(newName)
>     {
>         _template = new Wt::WTemplate(Wt::WString::tr(getName()), this);
>     }
>
>     inline const std::string &getName() const { return name; }
> };
>

When I bind a template to widgets in a derived class it doesn't work for
when I do so in the View class it does show the widgets.

Here's the implementation of the derived class ctor:

> AuthenticationView::AuthenticationView()
> :    View("login")
> {
>     // All this code works when I move it to the View ctor
>     WContainerWidget *usrContainer = new WContainerWidget();
>
>     WLabel *usrLbl = new WLabel("Username: ", usrContainer);
>
>     username = new WLineEdit(usrContainer);
>     username->setValidator(new WValidator(true));
>
>     usrLbl->setBuddy(username);
>
>     WContainerWidget *pwdContainer = new WContainerWidget();
>
>     WLabel *pwdLbl = new WLabel("Password: ", pwdContainer);
>
>     password = new WLineEdit(pwdContainer);
>     password->setEchoMode(WLineEdit::Password);
>     password->setValidator(new WValidator(true));
>
>     pwdLbl->setBuddy(password);
>
>     submit = new WPushButton("Submit");
>
>     _template->bindWidget("username", usrContainer); // binding here
>     _template->bindWidget("password", pwdContainer); // and here
>     _template->bindWidget("submit", submit); // and here
> }
>

Anyone can give me a direction?
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to