Project

General

Profile

animateHide() not doing what I'd expect

Added by Marcel Ebmer over 10 years ago

Hi everyone,

The example below does nothing but display two widgets - and hide one when the other is clicked.

Problem is: the animation is not shown in either Firefox 30 or Chromium 35. Instead, the hide_me_widget stays where it was until I reload the page. After reload, it is immediately gone.

I am sure I must be overlooking something...

#include <Wt/WApplication>
#include <Wt/WPushButton>
#include <Wt/WContainerWidget>

Wt::WAnimation slide_in_from_left(Wt::WAnimation::SlideInFromLeft);

class FooApplication : public Wt::WApplication {
public:
    FooApplication(Wt::WEnvironment const& env)
        : Wt::WApplication(env),
          hide_me_widget(new Wt::WContainerWidget(root())),
          hider_button(new Wt::WPushButton("hide!", root())) {

        hider_button->clicked().connect([&](Wt::WMouseEvent const&) {
            hide_me_widget->animateHide(slide_in_from_left);
        });
        hide_me_widget->addWidget(new Wt::WText("I can be hidden."));
    }

    static FooApplication* create(Wt::WEnvironment const& env) {
        return new FooApplication(env);
    }

private:
    Wt::WContainerWidget* hide_me_widget;
    Wt::WPushButton* hider_button;
};

int main(int argc, char** argv) {
    return Wt::WRun(argc, argv, &FooApplication::create);
}

Replies (1)

RE: animateHide() not doing what I'd expect - Added by Alex V over 10 years ago

I can confirm that animateHide(animation) and setHidden(true, animation) do not appear to function correctly using wt 3.3.3 firefox 30. for Wt::WAnimation::SlideInFromLeft animations.

It appears to work using the fade animation though.

however using Wt::WAnimation::SlideInFromLeft for a WStackedWidget transition appears to work.

Regards,

Alex

    (1-1/1)