Hi,
I am trying the JSlots and I think they are great!!! There are some
behaviours in my WebGL app that affect the scene and that don't need
communication to the server at all!!
I was trying to connect a JSlot to a button so initially I did something
like
JSlot* slot = new JSlot();
slot->setJavaScript("function(obj,evn){ blah blah ....}");
WCheckBox* box = new WCheckBox("option 1");
and then:
box->changed().connect(slot);
I was having weird cryptic "boost" error messages. Nothing relative to
what I was doing. So I checked the annotated examples
(http://www.webtoolkit.eu/wt/doc/examples/html/group__javascript.html)
and the only thing that caught my attention is that the JSlot is being
allocated as a stack object insted of a heap object, or, in other words,
no pointer * is required.
When I made this change:
JSlot slot;
slot.setJavaScript("function(obj,evn){ blah blah ....}");
WCheckBox* box = new WCheckBox("option 1");
box->changed().connect(slot);
It did not work EITHER!!
So I assumed the connect method does not keep a reference to an object
that lives on the stack with a local scope (as I was declaring my JSlot
also inside my "buildGUI" method). So I declared the JSlot as a private
member of my class (so it survived the buildGUI call). And VOILA! It WORKED!
I think it would be useful for people who would like to use the JSlot
functionality to see a "mini fragment of code" like the previous one,
directly on the doc of the JSlot class. That way you don't have to go
all the way to the examples and try to figure out how your code is
different from the example. Sometimes the problem is not evident for the
regular Joe programmer. Or maybe it's because I am so used to these kind
of refreshers from javadocs (maybe I am too lazy). lol.
Anyway, I hope this can help anyone.
Diego
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest