Discussion:
[Wt-interest] animateShow failure
K. Frank
2015-01-03 02:54:38 UTC
Permalink
Hello List!

animateShow appears to fail in a simple test application.

I have been having trouble getting animateShow / animateHide
to work properly, so I tried a simple test and it seems to fail, at
least on chrome, firefox, and ie. (The simple test works on opera).

Please take a look at the test program (below) and let me know
if I am doing something wrong or if this is a known issue.

One button is connected to WText::hide() and another to
WText::animateShow(). The first time animateShow is called, it
works, but subsequent calls fail.

I see half a dozen WAnimation bugs (most resolved) on the issue
tracker:

http://redmine.webtoolkit.eu/projects/wt/issues

but none are this plain-vanilla or obviously directly relevant.

I am running Wt 3.3.3 built natively with 64-bit mingw-w64 on
64-bit windows 7. The browsers are

chrome: Version 39.0.2171.71 m
firefox: 32.0.2
ie: Version: 11.0.9600.17420
opera: Version 12.17 (test works on opera)

Any advice on using animations correctly would be appreciated.

The test program appears below. The symptom: Click the Hide
button, "show / hide text" is hidden, click Show, the text is shown,
click Hide and Show again, and the text stays hidden.

Thanks.


K. Frank


==========

#include <Wt/WAnimation>
#include <Wt/WApplication>
#include <Wt/WBreak>
#include <Wt/WPushButton>
#include <Wt/WText>

using namespace Wt;

class AnimateTest : public WApplication {
public:
AnimateTest (const WEnvironment& env);
private:
WPushButton *showButton_;
WPushButton *hideButton_;
WText *text_;
void show();
void hide();
};

AnimateTest::AnimateTest (const WEnvironment& env) : WApplication(env) {
showButton_ = new WPushButton ("Show", root());
hideButton_ = new WPushButton ("Hide", root());
new WBreak (root());
text_ = new WText ("show / hide text", root());
showButton_->clicked().connect (this, &AnimateTest::show);
hideButton_->clicked().connect (this, &AnimateTest::hide);
}

void AnimateTest::hide() { text_->hide(); }
void AnimateTest::show() { text_->animateShow (WAnimation
(WAnimation::SlideInFromRight)); }

WApplication *createApplication(const WEnvironment& env) {
return new AnimateTest (env);
}

int main (int argc, char **argv) {
return WRun (argc, argv, &createApplication);
}

==========
Koen Deforche
2015-01-05 08:46:03 UTC
Permalink
Hey,

Animation will not work on an 'inline' widget. You need to make the
following change to your code:
text_->setInline(false);

And I also fixed a bug that prevented the same widget to be animated a
second time in this case.

Regards,
koen
Post by K. Frank
Hello List!
animateShow appears to fail in a simple test application.
I have been having trouble getting animateShow / animateHide
to work properly, so I tried a simple test and it seems to fail, at
least on chrome, firefox, and ie. (The simple test works on opera).
Please take a look at the test program (below) and let me know
if I am doing something wrong or if this is a known issue.
One button is connected to WText::hide() and another to
WText::animateShow(). The first time animateShow is called, it
works, but subsequent calls fail.
I see half a dozen WAnimation bugs (most resolved) on the issue
http://redmine.webtoolkit.eu/projects/wt/issues
but none are this plain-vanilla or obviously directly relevant.
I am running Wt 3.3.3 built natively with 64-bit mingw-w64 on
64-bit windows 7. The browsers are
chrome: Version 39.0.2171.71 m
firefox: 32.0.2
ie: Version: 11.0.9600.17420
opera: Version 12.17 (test works on opera)
Any advice on using animations correctly would be appreciated.
The test program appears below. The symptom: Click the Hide
button, "show / hide text" is hidden, click Show, the text is shown,
click Hide and Show again, and the text stays hidden.
Thanks.
K. Frank
==========
#include <Wt/WAnimation>
#include <Wt/WApplication>
#include <Wt/WBreak>
#include <Wt/WPushButton>
#include <Wt/WText>
using namespace Wt;
class AnimateTest : public WApplication {
AnimateTest (const WEnvironment& env);
WPushButton *showButton_;
WPushButton *hideButton_;
WText *text_;
void show();
void hide();
};
AnimateTest::AnimateTest (const WEnvironment& env) : WApplication(env) {
showButton_ = new WPushButton ("Show", root());
hideButton_ = new WPushButton ("Hide", root());
new WBreak (root());
text_ = new WText ("show / hide text", root());
showButton_->clicked().connect (this, &AnimateTest::show);
hideButton_->clicked().connect (this, &AnimateTest::hide);
}
void AnimateTest::hide() { text_->hide(); }
void AnimateTest::show() { text_->animateShow (WAnimation
(WAnimation::SlideInFromRight)); }
WApplication *createApplication(const WEnvironment& env) {
return new AnimateTest (env);
}
int main (int argc, char **argv) {
return WRun (argc, argv, &createApplication);
}
==========
------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is
your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
witty-interest mailing list
https://lists.sourceforge.net/lists/listinfo/witty-interest
K. Frank
2015-01-07 00:45:00 UTC
Permalink
Hi Koen!

Thanks for following up.

Please let me emphasize that my issue not urgent, and not really
important in any way. I'm just playing around with Wt trying to
learn what it does and how to use it. So I appreciate your advice,
but I'm not making any specific requests.
Post by Koen Deforche
Hey,
Animation will not work on an 'inline' widget. You need to make the
text_->setInline(false);
Please let me clarify to be sure I understand:

1) To use animation, I need a non-inline widget, e.g. setInline(false);

But

2) Even with setInline(false);, my use case -- hiding and showing the
same widget repeatedly -- is not expected to work correctly because
of the bug you mention below.

Is this correct?
Post by Koen Deforche
And I also fixed a bug that prevented the same widget to be animated a
second time in this case.
Again, just to confirm, does this bug mean that my test program is not
expected to work (even with setInline(false);)?

Is the bug fix simple? Is it something I can hand-patch in my build of
Wt 3.3.3?

I did add setInline(false); to my test program, specifically:

AnimateTest::AnimateTest (const WEnvironment& env) : WApplication(env) {
showButton_ = new WPushButton ("Show", root());
hideButton_ = new WPushButton ("Hide", root());
new WBreak (root());
text_ = new WText ("show / hide text", root());
text_->setInline (false); // <-- only change to test program
showButton_->clicked().connect (this, &AnimateTest::show);
hideButton_->clicked().connect (this, &AnimateTest::hide);
}

void AnimateTest::hide() { text_->hide(); }
void AnimateTest::show() { text_->animateShow (WAnimation
(WAnimation::SlideInFromRight)); }

I still see the same behavior -- the text does not reappear after the
second attempt to show it. (I only checked ie and chrome, and both
show the same behavior.)
Post by Koen Deforche
Regards,
koen
Thanks again.


K. Frank
Post by Koen Deforche
Post by K. Frank
Hello List!
animateShow appears to fail in a simple test application.
...
Please take a look at the test program (below) and let me know
if I am doing something wrong or if this is a known issue.
One button is connected to WText::hide() and another to
WText::animateShow(). The first time animateShow is called, it
works, but subsequent calls fail.
...
The test program appears below. The symptom: Click the Hide
button, "show / hide text" is hidden, click Show, the text is shown,
click Hide and Show again, and the text stays hidden.
...
==========
#include <Wt/WAnimation>
#include <Wt/WApplication>
#include <Wt/WBreak>
#include <Wt/WPushButton>
#include <Wt/WText>
using namespace Wt;
class AnimateTest : public WApplication {
AnimateTest (const WEnvironment& env);
WPushButton *showButton_;
WPushButton *hideButton_;
WText *text_;
void show();
void hide();
};
AnimateTest::AnimateTest (const WEnvironment& env) : WApplication(env) {
showButton_ = new WPushButton ("Show", root());
hideButton_ = new WPushButton ("Hide", root());
new WBreak (root());
text_ = new WText ("show / hide text", root());
showButton_->clicked().connect (this, &AnimateTest::show);
hideButton_->clicked().connect (this, &AnimateTest::hide);
}
void AnimateTest::hide() { text_->hide(); }
void AnimateTest::show() { text_->animateShow (WAnimation
(WAnimation::SlideInFromRight)); }
WApplication *createApplication(const WEnvironment& env) {
return new AnimateTest (env);
}
int main (int argc, char **argv) {
return WRun (argc, argv, &createApplication);
}
==========
Koen Deforche
2015-01-19 14:10:37 UTC
Permalink
Hey,
Post by K. Frank
1) To use animation, I need a non-inline widget, e.g. setInline(false);
But
2) Even with setInline(false);, my use case -- hiding and showing the
same widget repeatedly -- is not expected to work correctly because
of the bug you mention below.
Is this correct?
Yes.
Post by K. Frank
Again, just to confirm, does this bug mean that my test program is not
expected to work (even with setInline(false);)?
Yes.
Post by K. Frank
Is the bug fix simple? Is it something I can hand-patch in my build of
Wt 3.3.3?
It would be simple if it were not from the complication that the JS is
minified.

The patch is the following:

diff --git a/src/js/WWebWidget.js b/src/js/WWebWidget.js
index 1ccdbed..8298be0 100644
--- a/src/js/WWebWidget.js
+++ b/src/js/WWebWidget.js
@@ -261,6 +261,7 @@ WT_DECLARE_WT_MEMBER
if (hide)
el.style.display = display;
restore(el, elStyle);
+ onEnd();
});
}

Then you could copy WWebWidget.js to WWebWidget.min.js (not really
minifying it).

Regards,
koen
K. Frank
2015-01-19 19:28:47 UTC
Permalink
Hi Koen -
Post by Koen Deforche
Hey,
...
Post by K. Frank
2) Even with setInline(false);, my use case -- hiding and showing the
same widget repeatedly -- is not expected to work correctly because
of the bug you mention below.
Is this correct?
Yes.
Post by K. Frank
Again, just to confirm, does this bug mean that my test program is not
expected to work (even with setInline(false);)?
Yes.
...
...
Thanks for the suggested patch. If I get the chance to test
it, I'll let you know how it goes.
Post by Koen Deforche
...
Regards,
koen
Thanks again for your help.


K. Frank
K. Frank
2015-04-22 12:49:32 UTC
Permalink
Hello Koen!

I'm BACK!!!

(Just a reminder about the context: I'm new to Wt and just
playing around with it. The animateShow issue is in no way
urgent for me which is why it's taken a couple of months for
me to get back to it.)
Post by Koen Deforche
Hey,
Post by K. Frank
1) To use animation, I need a non-inline widget, e.g. setInline(false);
But
2) Even with setInline(false);, my use case -- hiding and showing the
same widget repeatedly -- is not expected to work correctly because
of the bug you mention below.
Is this correct?
Yes.
Just to confirm, I did add setInline(false) to my test code, and
the issue with animateShow did persist.
Post by Koen Deforche
Post by K. Frank
Again, just to confirm, does this bug mean that my test program is not
expected to work (even with setInline(false);)?
Yes.
Post by K. Frank
Is the bug fix simple? Is it something I can hand-patch in my build of
Wt 3.3.3?
It would be simple if it were not from the complication that the JS is
minified.
I am new to JS. I think I understand this, but please let me check.
"Minified" JS is legal JS, but it's been textually compressed (e.g.,
replace "someLongInformativeVariableName" with "a"), without
modifying its semantics. Correct?

In my (JS) source directory:

.\wt-3.3.3\src\js

I have both:

WWebWidget.js

and

WWebWidget.min.js

My understanding is that the minified file, WWebWidget.min.js,
came from you guys when I downloaded the Wt source bundle,
and was NOT produced when I built the Wt libraries. Correct?

When I build my Wt application, I refer to the Wt include directory
and the Wt libraries I built. I do not set anything that looks like JS
in the include files. I do see strings in WWebWidget.obj (created
when I built the Wt libraries) that look like they might have come
from WWebWidget.min.js.

Is the following correct?

When I build the Wt libraries, the .js files are not used -- I could
have deleted them right after I downloaded the source bundle.

When I build the Wt libraries, the flow of information is:

WWebWidget.min.js --> WWebWidget.obj --> libwt.a

and when I build by Wt application, I get the relevant (minified)
JS out of libwt.a at link time.
Post by Koen Deforche
diff --git a/src/js/WWebWidget.js b/src/js/WWebWidget.js
index 1ccdbed..8298be0 100644
--- a/src/js/WWebWidget.js
+++ b/src/js/WWebWidget.js
@@ -261,6 +261,7 @@ WT_DECLARE_WT_MEMBER
if (hide)
el.style.display = display;
restore(el, elStyle);
+ onEnd();
});
}
Then you could copy WWebWidget.js to WWebWidget.min.js (not really minifying
it).
Based on my above understanding, after I patch WWebWidget.js
(and copy it to WWebWidget.min.js), I would need to rebuild the Wt
libraries. More specifically, I would need to recompile WWebWidget.obj,
and relink libwt.a, but these specific details should be taken care of
by the make process. Is this all correct?

As an aside, would it suffice to simply recompile WWebWidget.obj,
and, when I build my application, link to WWebWidget.obj (ahead of
libwt.a on the command line) to pick up the patched JS, or would that
lead to some kind of multiply-defined-symbol problem, or otherwise fail?
(I am using mingw-w64, a 64-bit windows version of gcc, if that matters.)
Post by Koen Deforche
Regards,
koen
Thanks very much for your help and explanations, and for Wt!


K. Frank

Loading...