It does matter, I think in the context you are calling, 'this' has no
context. If you change those lines to :
_this.info(...) etc. it might work as long as _this is a global var, and
the way you initialized it, it's a local var. When you make a call to a
function that is not part of an object, there is no 'this' object. 'this'
only resides inside an objects code, not code that an object calls unless
you pass in a reference to it as a param and then use that reference to make
the info calls.
Jim
On Tue, Apr 8, 2008 at 11:23 AM, cboulanger <[EMAIL PROTECTED]> wrote:
> Jim Hunter schrieb:
> > I use this.info <http://this.info> inside event handlers, at least
> > with the handling of 'completed' event of a Request, all the time. The
> > one thing to remember is that the 'this' does not refer to the object
> > that fired the event, it refers to the event object (unless you pass
> > in a reference to the firing object as the last param of the event
> > call. Give an example of code that does not work and maybe we can get
> > it working.
> >
> > Jim
> >
>
> Hi Jim,
>
> good to know that this must be a special case then. It is not easy to
> isolate the problem because the event handler is in a mixin and calls a
> function in another mixin.
>
> It goes like this:
>
> var rpc = new qx.io.remote.Rpc();
> [...]
> var _this = this;
> [...]
> // start request
> var callbackFunc = function(data, ex, id) {
> [...]
> request.reset();
> request.dispose();
> request = null; // dispose rpc object
> if (ex == null)
> {
> [...]
> // handle received data
> if ( data.result )
> {
> _this.__handleDataReceived (data.result);
> }
>
> ok, then we are here:
>
> __handleDataReceived : function(result)
> {
> [....]
> this.setWidgetData(result);
>
> moving onto here:
>
> setWidgetData : function (data)
> {
> [...]
>
> // extended setter using a hash map
> for ( var key in data )
> {
> switch (key)
> {
> [...]
> /* qx.ui.treeVirtual.SimpleTreeDataModel */
> case "treedatamodel":
> if (! this instanceof qx.ui.treevirtual.TreeVirtual )
> {
> this.error("Rpc datatype 'treedatamodel' only valid for
> qx.ui.treevirtual.TreeVirtual!");
> return false;
> }
> this.handleServerData(data.treedatamodel);
> break;
>
> which takes us to a different mixin:
>
> handleServerData : function( data )
> {
> this.info("This won't be printed");
> this.warn("Neither will this show up");
> this.error("This will silently end execution");
>
>
> Shouldn't it make no difference which object "this" refers to? In my
> case, it is a TreeVirtual object.
> But I also tried qx.core.Init.getInstance().warn("I want this to show!")
> with no effect.
>
> Maybe you have an idea...
>
> Christian
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Register now and save $200. Hurry, offer ends at 11:59 p.m.,
> Monday, April 7! Use priority code J8TLD2.
>
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
--
Jim Hunter
DAILY THOUGHT: SOME PEOPLE ARE LIKE SLINKIES - NOT REALLY GOOD
FOR ANYTHING BUT THEY BRING A SMILE TO YOUR FACE WHEN PUSHED DOWN THE STAIRS
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel