Hi,

Server side modifications don't trigger signals. If you want that anyway,
you need to emit the signal after making the change:

lin1->changed().connect(std::bind([=] (){lin2->setText(lin1->text());
lin2->changed().emit()}));

BR,
Wim.



2013/12/5 Muhammad Nasser Al-Noimi <mnno...@gmail.com>

>  Hi,
>
> I'm trying to create a cascaded text changes using WLineEdit, but I
> noticed that method setText does not emit changed() signal. Is this normal
> behavior? What is the fastest way to achieve that?
>
> I wrote a simple snapshot to describe my point:
>
> #include <Wt/WApplication>
> #include <Wt/WLineEdit>
> #include <Wt/WPushButton>
>
> using namespace Wt;
>
> class MainApplication: public WApplication {
> public:
>     MainApplication(const WEnvironment& env);
>
> private:
>
> };
>
> MainApplication::MainApplication(const WEnvironment& env)
>     : WApplication(env)
> {
>     WLineEdit* lin1 = new WLineEdit(root());
>     WLineEdit* lin2 = new WLineEdit(root());
>     WLineEdit* lin3 = new WLineEdit(root());
>     WLineEdit* lin4 = new WLineEdit(root());
>     WPushButton* btn = new WPushButton("Click Me", root());
>
>     lin1->changed().connect(std::bind([=]
> (){lin2->setText(lin1->text());}));
>     lin2->changed().connect(std::bind([=]
> (){lin3->setText(lin2->text());}));
>     lin3->changed().connect(std::bind([=]
> (){lin4->setText(lin3->text());}));
>     btn->clicked().connect(std::bind([=] (){lin1->setText("Hello");}));
> }
>
> WApplication *createApplication(const WEnvironment& env)
> {
>     return new MainApplication(env);
> }
>
> int main(int argc, char **argv)
> {
>     char* params[7] = {argv[0], "--docroot", ".", "--http-address",
> "0.0.0.0", "--http-port", "8081"};
>     return WRun(7, params, &createApplication);
> }
>
> Regards,
> Nasser  Al-Noimi
>
>
> ------------------------------------------------------------------------------
> Sponsored by Intel(R) XDK
> Develop, test and display web and hybrid apps with a single code base.
> Download it for free now!
>
> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>
------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to