Bug #2801
openHide with setHidden and a Animation don't work
0%
Description
Hello,
I'm using wt 3.3.1 and I'll show and hide a widget with animation.
So I used the following code for show:
this~~_infoBox~~>setHidden(false, WAnimation(WAnimation::Fade, WAnimation::Ease, 1000));
It works as expected.
For hiding I used this line:
this~~_infoBox~~>setHidden(true, WAnimation(WAnimation::Fade, WAnimation::Ease, 500));
But after it, the widget isn't hidden. So I tested other lines. First:
this~~_infoBox~~>setHidden(true);
It works! But the following don't work:
this~~_infoBox~~>setHidden(true, WAnimation(WAnimation::Fade));
Greetings
Torsten
Files
Updated by Wim Dumon over 10 years ago
- Status changed from New to Feedback
Hi Torsten,
I tried to reproduce this on hello world, fading a WLineEdit, but it seems like animation works as expected. Can you make a small example that demonstrates the problem?
BR,
Wim.
Updated by Torsten Schulz over 10 years ago
Hello Wim,
sorry for my late answer, I hadn't an account before.
That's what I had done:
Aplication constructor:
enableUpdates(true);
class ChannelControlPanel : public MyPanel {
public:
ChannelControlPanel();
private:
...
WContainerWidget *_infoBox;
WTimer *_changeMessageTimer;
void ChannelControlPanel::_changeMessage()
{
if (this->_messagesQueue.size() > 0) {
this->_infoBox->clear();
this->_infoBox->addWidget(new WText(WString::tr(this->_messagesQueue.front().toUTF8())));
this->_messagesQueue.pop_front();
if (this->_infoBox->isHidden()) {
this->_infoBox->setHidden(false, WAnimation(WAnimation::Fade, WAnimation::Ease, 1000));
this->_infoBox->clicked().connect(this, &ChannelControlPanel::_changeMessage);
}
if (this->_changeMessageTimer == NULL) {
this->_changeMessageTimer = new WTimer(this);
this->_changeMessageTimer->setInterval(7500);
this->_changeMessageTimer->timeout().connect(this, &ChannelControlPanel::_changeMessage);
this->_changeMessageTimer->start();
}
}
else if (this->_infoBox->isHidden() == false){
this->_infoBox->setHidden(true, WAnimation(WAnimation::Fade, WAnimation::Ease, 500));
this->_changeMessageTimer = NULL;
}
}
And the part thats wondering is:
setHidden(false, ...);
and
setHidden(true);
works as expected, but
setHidden(true, WAnimation(...));
don't works.
Updated by Torsten Schulz over 10 years ago
I've a new information. It isn't working for only with chrome (I'm testing with chrome 35). At Firefox its ok.
Updated by Marcel Ebmer over 10 years ago
I have experienced a similar problem (also posted this on the forum).
The below full example exhibits the problem in Firefox 30 and Chromium 35. The hide_me_widget stays where it was until I reload the page. After reload, it is immediately gone.
#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);
}
Updated by Koen Deforche over 10 years ago
- Status changed from Feedback to InProgress
- Assignee set to Koen Deforche
- Target version set to 3.3.4
Updated by Koen Deforche over 10 years ago
Hey,
I could fix the issue from Marcel but I guess that's unrelated to the original problem.
I believe there must be something we are overlooking in the animation that is caused by how you are setting up the widgets. Can you isolate the misbehavior in a self-contained test-case?
Regards,
koen
Updated by Koen Deforche over 10 years ago
- Status changed from InProgress to Feedback
Updated by Torsten Schulz over 9 years ago
Hello,
sorry for the late answer. I'll try to make it in the next days, but I was too busy (by other important implementations) to do it.
Regards,
Torsten
Updated by Torsten Schulz over 9 years ago
Hello,
I created an example app. There you can see the not working animation on hiding.