On Fri, May 20, 2011 at 10:30 PM, John Cawley III <[email protected]> wrote:
> I am attempting to call an interface method for a .net class and am
> having difficulty. I'm using IronRuby v1.1.2 and working with
> ScintillaNet, a .net wrapper for the Scintilla control.
John, I'm a little unclear about the problem you're trying to solve
... I've got some questions inline:
> A portion of the ScintillaNet::Scintilla class is below:
>
> namespace ScintillaNet
> {
> ...
> public partial class Scintilla : Control, INativeScintilla,
> ISupportInitialize
> {
> ...
Is BackTab implemented in any other partial C# class of Scintilla? If
not, than you should be getting a compiler error ...
> }
> }
>
> And a portion of the ScintillaNet::INativeScintilla interface is below:
>
> namespace ScintillaNet
> {
> public interface INativeScintilla
> {
> ...
> void BackTab();
> ...
> }
> }
>
> I came across another forum discussion
> http://rubyforge.org/pipermail/ironruby-core/2009-January/003520.html,
> which seems to fall along the lines of what I'm trying to do, but I'm
> not sure the features discussed there are implemented yet.
That thread is about calling *explicit* interface methods, which we do
now support, though the API needs some work:
http://ironruby.codeplex.com/workitem/1594.
> I've reduced the troublesome code to a relatively short length to play
> with alternative approaches:
>
> require "bin/ScintillaNet"
> class ScintillaNet::Scintilla
> include ScintillaNet::INativeScintilla
How come your including this interface here? In C# this class already
implements INativeScintilla ...
> def self.ztest2()
> z = ScintillaNet::Scintilla.new()
> puts "z[#{z}]"
> #; z.BackTab() # undefined method `BackTab' for
> ScintillaNet.Scintilla:ScintillaNet::Scintilla (NoMethodError)
This works if I implement BackTab in this class, but again not sure if
that's what you're trying to do...
> #; ScintillaNet::INativeScintilla(z).BackTab() # undefined method
> `INativeScintilla' for ScintillaNet:Module (NoMethodError)
This is invalid IronRuby; .NET interfaces are exposed to IronRuby as
ruby modules, and here you're using a module as a method.
> #; ScintillaNet::INativeScintilla.BackTab() # undefined method
> `BackTab' for ScintillaNet::INativeScintilla:Module (NoMethodError)
Also invalid as INativeScintilla is basically a module without any
actual methods implemented on it, as a .NET interface doesn't have
method implementations.
> puts "fence"
> end
> end
>
> ScintillaNet::Scintilla.ztest2()
> puts "done"
>
> The three approaches above yield the errors to the right of each line.
>
> Thanks in advance for any assistance you might be able to provide.
> --John
Let me know if you can clear those things up ...
~Jimmy
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core