Re: JavaScriptException during JSNI call: Invoking an instance method on a null instance

2013-11-25 Thread Boris Waguia
Thanks ChrisK, You saved my day. On Tuesday, October 23, 2012 3:23:21 PM UTC+2, ChrisK wrote: There were a few problems here. My first example calls a zero args function but is not formatted correctly. If you call something like this: th...@com.mine.PlayerImpl::callback(); It won't

Re: JavaScriptException during JSNI call: Invoking an instance method on a null instance

2013-03-26 Thread Niaz Ahamed
Thanks ChrisK,, You've done a smart job.. It is working. On Tuesday, October 23, 2012 6:53:21 PM UTC+5:30, ChrisK wrote: There were a few problems here. My first example calls a zero args function but is not formatted correctly. If you call something like this:

Re: JavaScriptException during JSNI call: Invoking an instance method on a null instance

2012-10-23 Thread ChrisK
There were a few problems here. My first example calls a zero args function but is not formatted correctly. If you call something like this: th...@com.mine.PlayerImpl::callback(); It won't work. It needs the method signature and parameters separated (no args signature doesn't imply no args

Re: JavaScriptException during JSNI call: Invoking an instance method on a null instance

2012-10-22 Thread Kartik Kaipa
Hey did you finally get this working. I am doing the exact same thing I pass in the instance of the object as a parameter in the function method Could you post the working code that you have. Would really apreciate it. Thanks, Kartik On Tuesday, March 23, 2010 7:31:24 PM UTC+5:30, Olivier

Re: JavaScriptException during JSNI call: Invoking an instance method on a null instance

2010-03-23 Thread Olivier Monaco
Hi Thomas, The problem with memory leaks in browser is that it's sometimes hard to understand where they come from. Here, we are writting a little piece of code that will be transformed (replacement of @...()) and incorporated into a more complexe code. I don't want to look at the generated code

Re: JavaScriptException during JSNI call: Invoking an instance method on a null instance

2010-03-23 Thread ChrisK
Hi, thanks for the answers again! Ok, I have some working code now! I think my issues were a combined not understand this became the $wnd object when written how I had it, plus not understanding what $entry actually does. Having said that the docs on $entry could be better than the few sentences

Re: JavaScriptException during JSNI call: Invoking an instance method on a null instance

2010-03-23 Thread Olivier Monaco
ChrisK, On 23 mar, 10:32, ChrisK cknow...@gmail.com wrote: Thomas - your solution worked from 6 worked but at first I didn't include both pairs of brackets after the function call MyMethod but it turns out they are required. With only one set (i.e. no arguments), it just doesn't work. I

Re: JavaScriptException during JSNI call: Invoking an instance method on a null instance

2010-03-23 Thread ChrisK
Ahhh ok. Sorry for the simple questions but I'm just getting my head around all this. I also have some other methods with arguments and have those working thanks to both of you. On Mar 23, 9:56 am, Olivier Monaco olivier.mon...@free.fr wrote: ChrisK, On 23 mar, 10:32, ChrisK

Re: JavaScriptException during JSNI call: Invoking an instance method on a null instance

2010-03-23 Thread ChrisK
Actually, Olivier's methods work in development mode but don't seem to compile with this error: Cannot make an unqualified reference to the instance method callback I've tried the pre-assignment of this to var that and also an argument to the JSNI method passing in my instance. I've tried both

Re: JavaScriptException during JSNI call: Invoking an instance method on a null instance

2010-03-23 Thread Olivier Monaco
ChrisK, For instance method, you need to reference the method from the instance like th...@ Here is my exact code that compile: private native void installListener() /*-{ var callback = $entry(this. @net.antidot.gwtcommon.mvp.share.client.channel.HTML5MessageChannel::process(Lnet/

Re: JavaScriptException during JSNI call: Invoking an instance method on a null instance

2010-03-22 Thread ChrisK
My above code got a little mangled along the way, the $entry part has (this, followed by a full stop, followed by @com.mine.PlayerImpl::callback()); -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to

Re: JavaScriptException during JSNI call: Invoking an instance method on a null instance

2010-03-22 Thread Thomas Broyer
On Mar 22, 4:23 pm, ChrisK cknow...@gmail.com wrote: My above code got a little mangled along the way, the $entry part has (this, followed by a full stop, followed by @com.mine.PlayerImpl::callback()); And that's the problem: this is a special keyword and will evaluate to the this context of

Re: JavaScriptException during JSNI call: Invoking an instance method on a null instance

2010-03-22 Thread ChrisK
Thanks for the reply! I'm not sure I understand why this evaluates to the plain JS context. I was going off the documentation here which seems to suggest you can use this in this way: http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html#methods-fields Or perhaps you just

Re: JavaScriptException during JSNI call: Invoking an instance method on a null instance

2010-03-22 Thread Olivier Monaco
Hi ChrisK, You need to understand how JavaScript works. Like in many languages, the this keyword means the current object. The JavaScript language allows you to manipulate code as a function. This function can be affected to any variable or object member, like: $wnd.js_callback = function() {

Re: JavaScriptException during JSNI call: Invoking an instance method on a null instance

2010-03-22 Thread Thomas Broyer
On 22 mar, 23:42, Olivier Monaco olivier.mon...@free.fr wrote: The call method of a JavaScript function allows you to call it with a differente this. Then, using $wnd.js_callback.call(otherObject), the this variable reference otherObject. So the glue is: var that = this; $wnd.js_callback